British MPs have voted to extend same-sex marriage and abortion rights in Northern Ireland, unless a new Stormont Executive is not formed by 21 October.
Campaigners have hailed the move as a "big step forward".
However, the changes will not come into effect if the DUP and Sinn Féin can reach agreement in the coming months.
A dispute between them caused the devolved executive to collapse in January 2017 and, despite several rounds of talks, they remain at odds.
On-off talks to restore the executive resumed in May after a hiatus of more than a year but have made no obvious progress, with the Irish Government saying key issues remained as of last week.
Abortion is currently illegal in Northern Ireland even in cases of rape, incest or when the foetus has a fatal physical defects.
The Supreme Court ruled last year that the ban was incompatible with human rights laws, although the specific case failed on a technicality.
British Prime Minister Theresa May's government has previously argued that the issue is one that must be resolved by locally-elected politicians.
Any liberalisation of the abortion or marriage laws has also been strongly opposed by the DUP, which props up Mrs May's government.
But with no sign that devolution will be restored any time soon, MPs have grown impatient, and many of Mrs May's own MPs backed the change.
"There's a road to go yet but today a big step forward #TheNorthISNext #LoveEquality," tweeted opposition Labour MP Stella Creasy, who led demands for abortion reform.
"Today we have said everyone in the UK deserves to be treated as an equal."
Thank you to everyone who today stood up for equality in Northern Ireland - whether for same sex marriage or abortion, today we have said everyone in the UK deserves to be treated as an equal. There's a road to go yet but today a big step forward #TheNorthISNext #LoveEquality— stellacreasy (@stellacreasy) July 9, 2019
Britain's Women and equality minister Penny Mordaunt added that the vote was "a welcome step forward".
"Parliament has agreed to address the lack of access to safe abortion in Northern Ireland. We must make sure women in every part of our UK can get the care they need," she tweeted.
However, the DUP's leader in the Commons, Nigel Dodds, said the vote drove "a coach and horses through the principle of devolution, overriding the concerns of people in Northern Ireland".
The changes were introduced as amendments to a law that delays elections in Northern Ireland to 21 October and potentially 13 January 2020, to allow further power-sharing talks.
The abortion amendment, which passed by 332 votes to 99, directs the British government to implement recommendations of a report published last year.
It said the law criminalising abortion should be repealed and the procedure legalised at least where the mother's health is at threat, in cases of rape or incest or severe foetal impairment.
The other amendment, passed by 383 votes to 73, requires the British government to introduce regulations "to provide that marriage between same-sex couples is lawful" in Northern Ireland.
The legislation must still be approved by the unelected upper House of Lords.
But Labour MP Conor McGinn, who put forward the same-sex marriage amendment, said it was "a fantastic victory".
He expressed hope that the devolved executive in Belfast would be up and running by October so it could introduce equal marriage.
"But if Stormont still isn't functioning by then, the LGBT community in Northern Ireland now know that Westminster will act to ensure equality and respect for all citizens, and finally give them the right to marry the person they love," he said.