Media playback is unsupported on your device Media caption Watch Martin McGuinness' resignation statement in full

Martin McGuinness has resigned as Northern Ireland's deputy first minister in protest against the handling of a botched energy scheme that could cost taxpayers £490m.

He cited the Democratic Unionist Party's (DUP) conduct over the Renewable Heat Incentive (RHI) scheme scandal as the main reason.

The Sinn Féin MLA's decision to quit is likely to lead to a snap election.

Outgoing First Minister Arlene Foster said his move was "not principled".

Media playback is unsupported on your device Media caption Outgoing First Minister Arlene Foster responded to the resignation in a statement released on Facebook

Under Northern Ireland's power-sharing agreement, Mrs Foster loses her first minister role with the departure of the deputy first minister, and she said she was "disappointed" by his move.

"At a time when we are dealing with Brexit, needing to create more jobs and investing in our health and education system, Northern Ireland needs stability," she said in a statement posted on her Facebook page.

"But because of Sinn Féin's selfish reactions, we now have instability.

"This is not an election of our making, but the DUP will always defend unionism and stand up for what is best for Northern Ireland."

'Conflict of interest'

The RHI scandal has been centre stage in politics in Northern Ireland over the past month, with DUP leader Mrs Foster facing repeated calls to resign, all of which she has rejected.

Image copyright Pacemaker Image caption Martin McGuinness said the time was right to "call a halt to the DUP's arrogance"

She set up the RHI scheme in 2012 when she was enterprise minister in an attempt by the Northern Ireland Executive to encourage production of heat from renewable sources rather than fossil fuels.

But flaws in setting the scheme's subsidy rate left it open to abuse as claimants could earn more cash the more fuel they burned, with the overspend estimated to be almost half-a-billion pounds.

Mr McGuinness said Mrs Foster had a "clear conflict of interest" in the scandal position was "not credible or tenable".

"Today is the right time to call a halt to the DUP's arrogance," he said.

People should be allowed "to make their own judgement on these issues democratically at the ballot box", added Mr McGuinness.

Prime Minister Theresa May has been updated on the resignation, Downing Street said.

Media playback is unsupported on your device Media caption What happens now the deputy first minister has resigned?

Speculation has surrounded Mr McGuinness' health since he cancelled a planned trip to China with Mrs Foster last month on medical advice.

Sinn Féin has not disclosed details of his recent illness, but Irish national broadcaster RTÉ reports that he has a rare heart condition.

He said his health had "nothing to do" with his decision to quit.

'Inflicting enormous damage'

In his resignation letter, Mr McGuinness said the DUP's handling of the RHI affair has been "completely out of step with [the] public mood".

He said people were "rightly outraged at the squandering of public money", and the DUP was refusing to accept demands for "robust action and accountability".

"The refusal of Arlene Foster to recognise the public anger or to exhibit any humility in the context of the RHI scandal is indicative of a deep-seated arrogance, which is inflicting enormous damage on the executive, the assembly and the entire body politic," he added.

Image caption Martin McGuinness' resignation means Northern Ireland looks likely to face a snap election

Analysis: Mark Devenport, BBC News NI political editor

Under the joint protocols that govern Stormont's power-sharing government, Martin McGuinness' resignation means First Minister Arlene Foster also loses her office.

She may continue to exercise some functions, but her role will be very limited.

Sinn Féin has seven days to nominate a new deputy first minister, but the party is adamant it will not replace him.

Read more: When he goes, she goes

Image copyright Pacemaker Image caption Martin McGuinness has been at the top of politics in Northern Ireland since he agreed to share power with Ian Paisley 10 years ago

An election could be called next week if Sinn Féin does not nominate a replacement as deputy first minister, and Mr McGuinness has said the party will not do that.

The veteran republican had been deputy first minister since the DUP and Sinn Féin made a historic agreement to share power in 2007.

But he said a number of issues in recent years had "raised all sorts of questions" about the behaviour of his party's partners in government.

'Deepens this crisis'

Allegations linking the DUP to other financial scandals, as well as a failure to approve funding for inquests into killings during Northern Ireland's Troubles and a recent decision to end funding for an Irish language project were "critical issues" for his party.

"There will be no return to the status quo except on terms that are acceptable to Sinn Féin," the Foyle MLA told reporters at Stormont.

But DUP MP Sammy Wilson said the deputy first minister had stepped down "in a way to deepen this crisis".

"It's in everyone's interests to try and pull back from the brink on this one and find a solution," he added.

"We have worked very hard to try and achieve that including the offer of a full public inquiry."

'Led from front'

Stormont's opposition parties were quick to react, with Ulster Unionist leader Mike Nesbitt saying Sinn Féin was "letting the DUP off the hook" by not pressing for a public inquiry into the RHI scandal.

Image copyright Pacemaker Image caption Mike Nesbitt said moving to an election before an inquiry in to the RHI scandal was "farcical"

Social Democratic and Labour Party leader Colum Eastwood said Sinn Féin were "only now waking up to the reality that the DUP have been running rings around them in government".

But Sinn Féin president Gerry Adams TD said his party colleague had "led from the front in the executive for the last 10 years" and "always put the people and the political process first".

Justice Minister Claire Sugden said the DUP and Sinn Féin's "inability to work together" is a "fundamental flaw", and would "continue to burden the people of Northern Ireland".

"A reasonable resolution could have been achieved, which leads me to believe that this crisis goes beyond RHI and points to a more intractable situation," she said.

DUP MP Jeffrey Donaldson said he was unsure whether power sharing could be restored in Northern Ireland even after an election.

He told RTÉ he was "not convinced" that coalition government could happen in the next few months, adding that an election would not resolve the issues.

Sinn Féin's Máirtín Ó Muilleoir said that power sharing could be restored if "the DUP commit to the principles of the Good Friday Agreement".

"We will never rebuild credibility in these institutions unless we commit again to the promise, to the principles and to the parity of esteem that is at the very foundation and root of the Good Friday Agreement," he said.

He accused the DUP of "trampling" on the agreement.