LONDON — Ireland’s deputy prime minister resigned Tuesday to avert a parliamentary vote that would have collapsed the government and triggered a snap election at a crunch time for Brexit negotiations.

Frances Fitzgerald quit hours before lawmakers had been due to vote on a no-confidence motion targeting her, filed by opposition party Fianna Fail.

She said she was stepping down “to avoid an unwelcome and potentially destabilizing general election at this historically critical time.”

Fianna Fail wanted Fitzgerald ousted over her involvement in a long-running police scandal. Opposition leaders accuse a previous government, in which Fitzgerald was justice minister, of failing to defend a whistleblower exposing corruption in Ireland’s police force.

They say newly disclosed emails show Fitzgerald knew about attempts by senior officers to discredit the whistleblower earlier than she had previously acknowledged.

Prime Minister Leo Varadkar’s Fine Gael party backed Fitzgerald, and she denied wrongdoing. But she said in a statement that she had decided to “put the national interest ahead of my own personal reputation.”

Had Fitzgerald not resigned, the minority government would almost certainly have lost Tuesday’s vote.

The resignation defuses the immediate crisis, but has weakened Varadkar’s five-month-old government, which relies on support from Fianna Fail to win votes in parliament.

It comes at a sensitive time in the Brexit process. EU leaders will decide at a Dec. 14-15 summit whether there has been enough progress to start discussions over Britain’s future relations with the bloc.

A key barrier to progress is the Irish border. Varadkar is pressing the U.K. to spell out how it can keep the currently invisible Ireland-Northern Ireland frontier free of customs posts and other barriers when the U.K. leaves the EU while Ireland remains a member.

The 310-mile (500-kilometer) frontier will be the U.K.’s only land border with an EU country. Any hurdles to the movement of people or goods could have serious implications for the economies on both sides, and for Northern Ireland’s peace process.