By Sam Cage and Padraic Halpin

DUBLIN (Reuters) - At the height of the euro zone's debt crisis in July 2011, Ireland's bailout looked doomed. Its credit rating had been cut to junk and borrowing costs hiked to an eye-watering 15 percent.

Nonetheless, Bank of Ireland convinced a group of North American investors to part with 1.1 billion euros and help stave off a state takeover. It was an early sign that Ireland could do what was needed to turn itself around.

Now the country's 85 billion-euro rescue is a rare and much needed success story for Brussels and its austerity policies that will be completed in December when the European Union, International Monetary Fund and European Central Bank formally release Ireland from their strict oversight.

"For our country it's been a backbreaking time, but it had to be. Because it was clear that only radical action could save us from total ruin," Enda Kenny, the premier who oversaw most of the three-year bailout, said at a party congress this month.

Driven deep into debt by a bank rescue and ballooning budget deficit, Dublin sought help in November 2010 to buy time to get its budget gap under control, overhaul its banks and regain market confidence. On those terms, the program has succeeded.

Ireland has hit every major target and the economy is on the mend, albeit slowly. The country of 4.6 million, with its history of poverty and emigration, managed to pass on salary cuts and tax rises without large-scale protests and also rewarded the investors who swooped on debts ranging from bad bank loans and government bonds to hotels and property assets.

"Ireland did what Ireland had to do and now everything is fine," German Finance Minister Wolfgang Schaeuble said recently.

Yet some major problems remain that could choke recovery.

Mortgage debt is far worse than it was three years ago - one in five home loans, worth 25 billion euros, are not being fully repaid. Overall debt at 124 percent of GDP is the euro zone's fourth highest and can only be managed on economic growth of 2-3 percent - far above near-stagnant forecasts for this year.

Story continues

With this in mind, the EU will struggle to use Ireland's departure from formal bailout conditions as a template for other euro zone countries like Greece, Spain or Portugal, not least because these others also have structural problems - bloated state sectors or restrictive labor codes - that Ireland didn't.

"It's important to sell this as a victory, but I'm not sure parallels can be drawn," said Antonio Barroso of political risks consultancy Teneo.

BAD DEBTS

Bank of Ireland's sale of a 35 percent stake started a trickle of good news - 2011 marked the first year of economic growth since 2007, unemployment stabilized and Dublin struck deals to ease the terms of its bailout loans and bank rescue, making its debt repayments more sustainable.

Two years later, the budget deficit has fallen from nearly a third of gross domestic product in 2010 to an estimated 7.3 percent this year - progress, but still the highest in the EU.

The Irish government now pays less than four percent to borrow for ten years and has successfully raised money on and off international money markets for the last eighteen months. It has decided not to issue more bonds this year as it has cash in hand and is even considering forgoing a new credit line from EU lenders that would provide funds in case of unexpected problems.

Yet the country's initial problem - banks that collapsed after lending cheap credit too easily, fuelling a property boom that also left homeowners with huge debt - has yet to be fully addressed. The central bank says it is still the biggest risk.

"Our debt level is very high and the position is still extremely fragile," said Lars Frisell, the central bank's chief economist.

Ireland has shut some banks, trimmed oversized loan books by a quarter and cut its proportionate use of total ECB funding to 4 percent from a peak of 19 percent.

But the state still controls two of the three surviving domestically-owned banks and has a residual stake in the third. Credit is scarce, hundreds of thousands of homeowners owe more money than their property is worth and the arrears problem is causing mounting concern over balance sheets.

The proportion of homeowners in arrears for over 90 days was 5.7 percent in December 2010 when distressed mortgages were barely mentioned in the original bailout agreement. It is now 12.7 percent and still rising.

That poses a risk, albeit a small one, for completion of the bailout because Dublin must still pass a review of bank assets.

It must also stop young people fleeing aboard as their ancestors did, from the 1800s famine to the 1980s recession.

Ann Cronin, 37, cannot find a job and risks losing her house because her father, who guaranteed the mortgage, incurred debts.

"In the last three years I've watched my family lose everything," said Cronin, a psychologist from the western county of Clare who is leaving to study for a doctorate in New Zealand. "When I tell people now I'm emigrating, I'm congratulated."

LESSONS LEARNED?

Ireland's "Celtic Tiger" model of growth is now clearly discredited. The empty housing estates built far from amenities are a stark reminder of a boom in which people mistakenly assumed accumulating more property guaranteed their future.

But Kenny's centrist coalition government, credited for trying to clear up the mess even as its policies impoverished voters, may have missed a chance to carry out deeper reforms.

Already Dublin is experiencing a mini housing boom, with prices rising 10 percent so far this year because supply is short in attractive and convenient areas. Ireland has a deep culture of home ownership, dating back to days when its British rulers forced Catholics to remain as tenants on the land.

While Dublin forges ahead, much of the countryside remains deep in depression with few jobs and shuttered shops, meaning the government must also now address a two-speed economy.

"We will still have difficult choices to make and further actions will be required to meet our targets in the years ahead," Finance Minister Michael Noonan said in his budget speech.

"(But) we will have closed this chapter of Ireland's history."

(Editing by Sophie Walker)