Tánaiste Frances Fitzgerald has said she is resigning for the sake of the country and to avoid a General Election, ending a week of political controversy.

Her resignation came ahead a Fianna Fáil motion of no confidence, which was due to be debated in the Dáil.

She said: "I believe it is necessary to take this decision to avoid an unwelcome and potentially destabilising general election at this historically critical time.

"Throughout my career I have always sought to act with integrity and responsibility, and that is why I have decided on this occasion to put the national interest ahead of my own personal reputation."

She reiterated that she acted correctly in difficult circumstances and did everything she could to protect whistleblowers.

A standoff between the main parties escalated last night following the publication of correspondence from the Department of Justice.

Taoiseach Leo Varakdar wrote to Fianna Fáil leader Micheál Martin confirming that Ms Fitzgerald had offered her resignation and that he had accepted it.

Speaking in the Dáil this afternoon, the Taoiseach said he accepted her resignation with deep regret.

He also paid tribute to Ms Fitzgerald as a reforming minister who was leaving her position "without a fair hearing".

He also said "a drip drip of information" may have made certain things seem greater than what they were. 

Mr Varadkar will temporarily take over her portfolio at the Department of Business, Enterprise and Innovation.

He said had the Department of Justice released the correspondence months ago, today's events would not have happened.

The Taoiseach also announced an external inquiry into the workings of the department, which will be completed before Christmas.

It will examine the relationship between the department and gardaí, with the Taoiseach saying he was "determined to shine the brightest of lights into the darkest of places".

In a speech to the Dáil this evening, Minister for Justice Charlie Flanagan apologised for his department's handling of the crisis.

Ms Fitzgerald has been selected by Fine Gael to contest in the next general election.

In a tweet, she said that she was honoured to be selected as a candidate for the party in the Dublin Mid West constituency. 

At a Cabinet meeting this morning, Ms Fitzgerald said she was not forced to resign or asked to, but was resigning on her own behalf.

At least eight Cabinet members spoke at the meeting with many expressing regret and upset at the decision.

Minister for Finance Paschal Donohoe refused to say if he was one of those ministers who spoke, but he said he understood that the Tánaiste made the decision on her own.

Speaking on RTÉ's News at One, Minister Donohoe said Mr Varadkar was a politician who formed a view based on his principles rather than on political expediency.

He said: "Leo stood by as Taoiseach, the role of a Tribunal, stood by the clear advice he received, even from the Attorney General, regarding what would have been proper or not proper to do.

"But of course, in recognising the effect this was having on the Government with all we have coming up beginning next week, he did decide he would accept Frances' resignation, which she offered of her own volition this morning."

The Minister for Health described Ms Fitzgerald as an honourable person, saying today was a difficult day.

Speaking on RTÉ’s Six-One News, Simon Harris said he respected the decision she made, but still believed the most appropriate place for adjudication is at the Charleton Tribunal.

He said the Taoiseach had shown political leadership in working with Fianna Fáil to try to avoid an election.

Correspondence released by the Department of Justice showed the Tánaiste had been notified in July 2015 of a media query about the approach taken by the then garda commissioner's legal team at the O'Higgins Commission of Investigation.

The development caused concern amongst some Fine Gael backbenchers and ministers.

Documents released by Department of Justice
Email chain regarding stance at O’Higgins Commission
Final report to Secretary General Noel Waters
Report to the Taoiseach 24 November 2017
Recommendations of the Toland Report
Letter from Disclosures Tribunal

A Government spokesman said last night that the Taoiseach was standing by the Tánaiste.

Ms Fitzgerald in turn tweeted that the latest documents had shown she had been advised not to interfere with the Commission.

The Disclosures Tribunal, she said, would judge the appropriateness of her conduct.

Fianna Fáil TD Darragh O'Brien has said his party took no pleasure in Ms Fitzgerald's resignation, but said she had made the correct decision.

He said Fianna Fáil wanted to "move on", and "work through this arrangement", adding that efforts to build trust between the Government and his party will have to be "redoubled".

Sinn Féin TDs David Cullinane has said the "credibility of the Taoiseach has to be challenged, after it was severely tested in recent days.

He said there should have been full disclosure (of the emails) to the Charleton Tribunal.

Mr Cullinane said his party is calling for full accountability and transparency, surrounding what he described as a "vicious lie" in relation to Sergeant Maurice McCabe.