Ireland‘s deputy prime minister Frances Fitzgerald has agreed to resign over handling of a police whistleblowing scandal, pulling the country back from the brink of a snap election.

Taoiseach Leo Varadkar confirmed his deputy would stand down in a phone call to opposition leader, Fianna Fail’s Micheal Martin, whose party threatened to bring down Ireland’s minority government over the affair.

Hours before she faced a motion of no confidence, Ms Fitzgerald said she had put the national interest ahead of her political career by resigning to avoid an “unwelcome and potentially destabilising” election.

John McDonnell: Brexit threatens to 'undermine the peace process' if Northern Ireland hard border installed

She said in a statement: “It has been the greatest honour of my life to serve in government, but I believe it is necessary to take this decision to avoid an unwelcome and potentially destabilising general election at this historically critical time.

“I have always believed in fairness and equality and these principles have guided my work as minister for children and youth affairs, as minister for justice and equality, and now as minister for business, enterprise and innovation.”

The move looks set to thwart a political crisis in Dublin, which were set to cast a shadow over a critical phase in the Brexit negotiations.

The Irish premier said he accepted her resignation with “deep regret” and insisted she would be vindicated by the Disclosures Tribunal.

He said: “It’s my strong view that a good woman is leaving office without getting a full and fair hearing. Frances has been an exemplary member of Government and a loyal colleague.”

Fianna Fail, which props up Mr Varadkar’s Government, wanted Ms Fitzgerald ousted over her involvement in a long-running police scandal, revolving around her knowledge of an aggressive legal strategy against a respected police officer during a private inquiry in 2015.

As well as threatening the fragile agreement between the parties, the uncertainty also came ahead of crunch Brexit talks which hinge on progress being made on the Irish border and other key issues.

Up until her resignation, the Republic was facing the prospect of a snap general election in the runup to Christmas and also in the teeth of the crucial Brexit summit in Brussels next month when the future of the Irish border could be determined.

Brexit: the deciders Show all 8 1 /8 Brexit: the deciders Brexit: the deciders European Union's chief Brexit negotiator, Michel Barnier Getty Brexit: the deciders French President Emmanuel Macron Getty Brexit: the deciders German Chancellor Angela Merkel Reuters Brexit: the deciders Commission President Jean-Claude Juncker EPA Brexit: the deciders The European Parliament's chief Brexit negotiator Guy Verhofstadt Getty Brexit: the deciders Britain's Prime Minister Theresa May Getty Images Brexit: the deciders Britain's Chancellor of the Exchequer, Philip Hammond PA Brexit: the deciders After the first and second appointed Brexit secretaries resigned (David Davis and Dominic Raab respectively), Stephen Barclay is currently heading up the position PA

It comes after emails dating back to 2015 were released by the Department of Justice, showing Ms Fitzgerald was aware of a controversial legal strategy to target a police offer at a private judge-led inquiry into claims of wrongdoing.