LONDON (Reuters) - British Prime Minister Theresa May appointed a former banker of South Asian origin as interior minister on Monday, trying to draw a line under an immigration scandal threatening her authority as she negotiates Brexit.

Sajid Javid, the son of immigrants from Pakistan, replaces Amber Rudd, who quit as Home Secretary after acknowledging she had “inadvertently misled” parliament by denying the government had targets for the number of illegal migrants Britain deports.

British ministers have struggled for two weeks to explain why some descendants of the so-called “Windrush generation”, invited to Britain from its former colonies to plug labor shortfalls between 1948 and 1971, were denied basic rights.

But in trying to solve one problem, May risked creating another by changing the balance of views in her top team on plans to leave the European Union. Rudd opposed Brexit but Javid, a lukewarm “remainer”, has said that after the referendum, “in some ways, we are all Brexiteers now”.

The scandal has weighed on May, who, after winning support for tough responses on Russia and Syria, has lost a close ally and must now try to overcome rifts in her Conservative Party over Brexit, especially on future customs arrangements with the European Union.

Javid, the first lawmaker from Britain’s Black, Asian and Minority Ethnic community to become interior minister, distanced himself in parliament from the “hostile environment” policy on illegal immigration pursued by May when she was home secretary.

“We are going to have a strategy in place ... about making sure that we have an immigration policy that is fair, it treats people with respect and with decency, and that will be one of my most urgent tasks,” Javid told Sky News earlier on Monday.

A spokesman for May said Javid, who had been minister for housing, communities and local government, “has proved his drive, his ambition and determination to get to grips with difficult subjects, and these are abilities which will all be required at the Home Office”.

May will hope Javid’s appointment deflects public anger over a problem the opposition Labour Party says is at least partly her fault because she spent six years as home secretary.

Out campaigning on Monday, May defended the use of targets to tackle illegal immigration and declined to answer directly when asked whether she should take the blame for what opposition lawmakers call a toxic culture at the Home Office.

BREXIT BALANCE

While aimed at ending the scandal, Javid’s appointment may also signal a shift on Brexit.

Rudd was one of the most outspokenly pro-EU members of May’s cabinet and could now join other Conservative lawmakers voting in favor of keeping the closest possible ties with the bloc.

Her position on May’s Brexit committee, a cabinet sub-grouping balanced between those who supported staying in the EU and those who wanted to leave, will now go to Javid.

His stance is less clear. An admirer of late prime minister Margaret Thatcher, he strongly supports free markets. Several pro-Brexit campaigners have said he is now firmly on their side and will oppose attempts to keep Britain so close to the EU.

That committee will meet this week to try to come up with a future customs arrangement with the EU that avoids a return to a hard border on the island of Ireland.

In the Irish border town of Dundalk, the bloc’s Brexit negotiator Michel Barnier said this would require rapid progress, and that a real risk remained of Britain leaving the bloc without an overall deal on future relations.

Slideshow ( 3 images )

There are more challenges ahead. The upper house of parliament on Monday defeated May’s government for the seventh time in two weeks by backing changes to legislation that will end Britain’s EU membership in March next year.

The House of Lords voted in favor of giving parliament powers to force the government back to the negotiating table, and even to halt Britain’s departure, if lawmakers do not think a final Brexit deal is good enough.

The proposals do have to be agreed by both chambers before they can become law, but could severely test May’s slim working majority in the lower house next month.

Slideshow ( 3 images )

TOUGH JOB

Javid’s primary job at the interior ministry, or Home Office, will not be an easy one either.

The department is one of the toughest to lead, responsible for immigration, the police and security at a volatile time of public spending cuts, Islamist attacks and Brexit talks.

May was the longest-serving home secretary in decades before becoming prime minister, and some opposition figures have accused her of drawing up overly harsh immigration policies.

Jeremy Corbyn, leader of the main opposition Labour Party, again called on her to answer questions about her time at the Home Office, when “she was presiding over, in her terms, the creation of a ‘hostile environment’”.

Rudd lasted less than two years, becoming the fourth minister May has lost to scandals in the last six months.

After days of apologies, she wrote in her resignation letter that she should have been aware of the deportation targets, but added that Britons “want people who have a right to live here to be treated fairly and humanely, which has sometimes not been the case” - a criticism of her own ministry, and perhaps of May.

May will hope Javid, known for a passion for detail when business minister, can ease the pressure on the ministry.

But some doubted whether he would soften the approach to immigration. “Sajid Javid is one of the most right-wing anti-immigration politicians in the Conservative Party,” said Dr Kehinde Andrews, an associate professor at Birmingham City University who specializes in race issues.

“The fact that his skin is brown does not change anything in that at all.”