Peter Slipper has resigned as the Speaker of the House of Representatives just hours after he survived by one vote a motion to dump him.
Mr Slipper quit his post under pressure to avoid continuing damage to the government which backed him during a brutal debate that laid bare the intense personal loathing between Julia Gillard and the Opposition Leader.
Mr Slipper survived by 70 votes to 69 after Tony Abbott moved a motion of no confidence in the Speaker, triggered by texts Mr Slipper sent his former staffer James Ashby.
Mr Slipper apologised for the text messages but this did not placate the opposition.
At 7.20pm, he entered the House for the first time since May when he stood aside from his duties, pending sexual harassment allegations. Choking back tears, he announced his resignation ''with great sadness''. ''It is in the interests of the Parliament that I do choose voluntarily to stand down at this time,'' he said.
Mr Slipper will continue in Parliament as an independent backbencher. The Deputy Speaker, Anna Burke, was set to replace him.
Labor will now routinely need the support of either Mr Slipper or the former Labor MP, Craig Thomson, to continue to govern.
Earlier, Mr Slipper tried to defuse the situation by apologising for the text messages which contained vulgar euphemisms for female genitalia and one described the Liberal frontbencher Sophie Mirabella as an ''ignorant botch''.
Mr Slipper said although the messages were private, ''nothing excuses their content''.
''I understand why people, particularly women, would be offended by these statements and I unreservedly apologise for them,'' he said.
Mr Slipper initially survived because three crossbenchers, Tony Windsor, Rob Oakeshott and Adam Bandt, voted with the government but their future support was not assured as they harboured misgivings about Mr Slipper's suitability for the role.
The Tasmanian independent, Andrew Wilkie, voted with the opposition, while Bob Katter abstained. He said he did not support Mr Slipper but nor would he support Parliament pre-empting a legal process.
Mr Slipper's resignation clears the way for the government to renew its attacks on Mr Abbott as a misogynist.
In moving the motion, Mr Abbott said the Prime Minister could not accuse him of misogyny and then ''defend the indefensible''.
''It's clear that this Speaker is no longer a fit and proper person to uphold the dignity of the Parliament. You indicate your unfitness for high office as well.''
Mr Abbott made a gaffe when he used the same term as Alan Jones when he insulted Ms Gillard's dead father.
Mr Abbott said every day the government defended Mr Slipper would ''be another day of shame for this Parliament and another day of shame for a government which should have already died of shame''.
Mr Abbott later told Jones's station, 2GB, it was an unintended reference and the criticism showed ''the political correctness police are on a rampage''.
In another act of defiance, the Deputy Opposition Leader, Julie Bishop, was a guest on Jones's program today, the first Coalition MP to do so since the scandal erupted.
In defending Mr Slipper, Ms Gillard excoriated Mr Abbott saying: ''I will not be lectured about sexism or misogyny by this man. If he wants to know what sexism looks like in the House of Representatives, he doesn't need a motion, he needs a mirror.''
She revealed sexist ''catcalls'' Mr Abbott made at her across the despatch table during question time and took issue with his attending a rally that featured unsavoury placards.
''He could apologise for standing next to signs describing me as a witch and a bitch,'' the Prime Minister said. ''The government is not dying of shame. My father did not die of shame.''
The Federal Court is due to rule any day now on whether to throw out the sexual harassment claim or send it to trial.
Separately, Mr Slipper is awaiting a decision by the Commonwealth Director of Pu.