LONDON -- Britain lurched closer to leaving the European Union Monday when Parliament stopped resisting and gave Prime Minister Theresa May the power to file for divorce from the bloc.

But in a blow to May’s government, the prospect of Scotland’s exit from the United Kingdom suddenly appeared nearer, too. Scottish First Minister Nicola Sturgeon called for a referendum on independence within two years to stop Scotland being dragged out of the EU against its will.

In an announcement that took many London politicians by surprise, Sturgeon vowed that Scotland would not be “taken down a path that we do not want to go down without a choice.”

Get Breaking News Delivered to Your Inbox

Sturgeon spoke in Edinburgh hours before the European Union (Notification of Withdrawal) Bill passed its final hurdle in Parliament’s upper chamber, the House of Lords.

The House of Commons approved the bill weeks ago, but the 800-strong Lords fought to amend it, inserting a promise that EU citizens living in the U.K. will be allowed to remain after Britain pulls out of the bloc.

They also added a demand that Parliament get a “meaningful” vote on the final deal between Britain and the remaining 27 EU nations.

Both amendments were rejected Monday by the Commons, where May’s Conservatives have a majority. A handful of pro-EU Conservatives expressed their unhappiness, then abstained from the vote.

The bill returned to the Lords, in a process known as parliamentary ping pong. Faced with the decision of the elected Commons, the Lords backed down and approved it without amendments.

Labor peer Dianne Hayter, who proposed the amendment on EU citizens, said the Lords had done their best, but “our view has been rejected in the elected House of Commons, and it is clear the government is not for turning.”

Once the bill receives royal assent -- a formality that should be accomplished within hours -- May will be free to invoke Article 50 of the EU’s key treaty, triggering two years of exit negotiations, by her self-imposed deadline of March 31.

May was forced to seek Parliament’s approval for the move after a Supreme Court ruling in January torpedoed her attempt to start the process of leaving the bloc without a parliamentary vote.

The House of Commons and House of Lords battled over the bill’s contents, with the status of EU nationals in Britain -- and Britons in fellow EU member countries -- drawing especially emotional debate.

Both British and EU officials have said such residents should be guaranteed the right to stay where they are, but the two sides have so far failed to provide a concrete guarantee, leaving millions of people in limbo.

Scottish National Party lawmaker Joanna Cherry told the House of Commons that one constituent, a Lithuanian, had told her “the uncertainty caused by this government and this Parliament is making her feel worse about her personal situation in Britain than she did in Lithuania under the Soviets.”

Brexit Secretary David Davis told lawmakers the government had a “moral responsibility” to the 3 million EU citizens living in Britain and the 1 million Britons in other member states, and intends to guarantee their rights as soon as possible after exit talks start.

“That is why we must pass this straightforward bill without further delay, so the prime minister can get to work on the negotiations and we can secure a quick deal that secures the status of both European Union citizens in the U.K. and also U.K. nationals living in the EU,” he said.

Pro-EU lawmakers accused the government and Brexit-backing lawmakers of running roughshod over the concerns of the 48 percent of Britons who voted to stay in the EU.

Conservative legislator Dominic Grieve called the government’s opposition of handing Parliament a final vote on Brexit “deranged,” and the Green Party’s Caroline Lucas said lawmakers should not just hand ministers a blank check.

“We were not elected to be lemmings,” Lucas said.

Euroskeptics accused pro-EU legislators of trying to frustrate the will of voters who passed a June referendum to leave the EU.

“The simple truth is this -- deal or no deal, vote or no vote, positive vote or negative vote, this process is irreversible,” Conservative legislator Edward Leigh said. “We’re leaving the EU, and that’s what the people want.”

May is now free to trigger Article 50 as early as Tuesday, but the government signaled the move would come much closer to the March 31 deadline.

May spokesman James Slack repeated the government’s position that it would happen by the end of March.

“I’ve said ‘end’ many times, but it would seem I didn’t put it in capital letters strongly enough,” he said.

The government’s satisfaction at victory in Parliament was tempered by the prospect of an independence vote that threatens the 300-year old political union between England and Scotland.

Sturgeon said she would seek to hold a referendum between the fall of 2018 and the spring of 2019 so Scottish voters could make an “informed choice” about their future.

While Britons overall voted to leave the EU, Scottish voters backed remaining by 62 to 38 percent, and Sturgeon said they should not be forced to follow the rest of the U.K. into a “hard Brexit” outside the EU single market.

In a 2014 referendum, Scottish voters rejected independence by a margin of 55 percent to 45 percent. But Sturgeon said the U.K.’s decision to leave the EU had brought about a “material change of circumstances.”

May -- whose government would have to approve a legally binding referendum -- accused Sturgeon’s Scottish National Party of political “tunnel vision” and called her announcement “deeply regrettable.”