LONDON — Ireland’s deputy prime minister has agreed to resign to avert a parliamentary vote that would have collapsed the government and triggered a snap election at a crunch time for Brexit negotiations, Irish media reported Tuesday.

Irish lawmakers had been due to vote later on a no-confidence motion targeting deputy premier Frances Fitzgerald, filed by opposition party Fianna Fail.

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 have backed Fitzgerald. But Irish broadcaster RTE and other outlets said Tuesday he has accepted her resignation, heading off a vote that the minority government would likely have lost.

The crisis comes at a crucial time for Varadkar’s five-month-old government. 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 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.