Peter O'Neill entered the prime minister's office surrounded in controversy and this morning he exited the same way, resigning after a mass defection of government MPs to the opposition.

Key points: Peter O'Neill said his government spent big on infrastructure, health and education

Peter O'Neill said his government spent big on infrastructure, health and education But outside the capital many schools, hospitals and roads are in bad shape

But outside the capital many schools, hospitals and roads are in bad shape Mr O'Neill's handling of an investigation into government corruption eroded his public support

All up he won two national elections and was in the country's top job for seven years.

In a history punctuated by frequent changes of leadership, he is only the second prime minister to serve a full term.

So, what's there to show for such a relatively long period of political stability? If you ask Papua New Guineans, especially the majority of people who live in rural and remote areas, many of them would tell you, not much.

When he announced his resignation in parliament, Mr O'Neill highlighted some of his government's achievements, including big spending on infrastructure, health and education.

There's no doubt there has been plenty of development in Port Moresby — last year the city hosted the APEC summit and foreign leaders stayed in shiny new hotels, were ferried around the city on resurfaced roads and met in a glitzy new convention centre.

But outside the capital, many schools, hospitals and roads are in bad shape, the police don't have the resources they need to enforce the rule of law and public servants regularly complain of not being paid on time.

Loading

There was a sense of public optimism in PNG when Mr O'Neill became prime minister in 2011, even though he replaced Sir Michael Somare, one of the founding fathers of PNG, in circumstances later deemed unconstitutional by the Supreme Court.

That optimism was soon boosted when Mr O'Neill established Task Force Sweep, a multi-agency investigation into government corruption.

Its investigators won praise for arresting and convicting dozens of public servants, businessmen and a former minister, while recovering tens of millions of dollars of public money in the process.

Mr O'Neil's ascension to PM tarnished after a Supreme Court battle with his rival, Sir Michael Somare. ( ABC News: Natalie Whiting )

Anti-corruption taskforce axed, splurging on 40 Maseratis

But things soured when Mr O'Neill himself became a target of its investigations. In 2014, police with the taskforce sought to arrest him over an allegation he authorised payments of more than $30 million to a law firm for fraudulent bills for legal work performed for the state.

Mr O'Neill refused to submit to questioning, described the allegations as politically motivated and said a letter seemingly signed by him authorising the payments was a forgery.

Days later, the government officially disbanded Task Force Sweep and Mr O'Neill went to court to thwart any further investigations.

Mr O'Neill's resignation followed weeks of high-profile defections from his government to the Opposition. ( AP: Craig Ruttle )

He did manage to shut down the investigation, but his actions eroded his public support. In 2016, students at the University of Papua New Guinea in Port Moresby boycotted class for several weeks in a protest against Mr O'Neill's handling of the corruption allegation.

They were supported by their parents, other citizens and civil groups.

In June, when the students attempted to march on Parliament police opened fire on the crowd and at least a dozen people were injured.

Questions were raised when 40 luxury Maseratis landed at Port Moresby's Jackson International Airport ahead of the APEC summit last year. ( ABC News: Natalie Whiting )

There were other controversies along the way such as the $1.2 billion loan to buy a stake in Australian-listed oil and gas company Oil Search in 2014.

The government mortgaged its expected revenue from a massive liquified natural gas project for the loan from the Australian arm of Swiss bank UBS, but the share price fell and they were sold two years later at a loss of $250 million.

A recently leaked report by PNG's Ombudsman Commission found the government may have breached 15 laws in securing the loan, including failing to gain parliamentary approval.

Even the hosting of the APEC summit last year, which should have been a credit to the government and the country, was marred in the minds of many locals by the decision to purchase a fleet of luxury cars, including 40 Maseratis and two Bentleys, to ferry dignitaries around Port Moresby.

Until now, Mr O'Neill managed to survive the scandals and thwart opposition attempts to unseat him, earning himself a reputation as a wily politician, but many Papua New Guineans feel his political cunning and long stint in the prime minister's office have made little difference to their lives.

Liam Fox was the ABC's PNG correspondent from 2009 to 2014.