Hungary's right-of-centre government agreed on Friday to mend ties with the EU, the IMF and the country's banks to stabilise the economy after credit agency Moody's cut Budapest's debt rating to junk and triggered a steep market selloff.

It was a dramatic about-face for Prime Minister Viktor Orban, who has ignored warnings that a campaign of unorthodox pro-growth reforms including a big bank tax and nationalising $14 billion (9 billion pounds) private pension asset was unsustainable.

Late on Thursday, Moody's cut Hungary's sovereign rating one notch to Ba1, just below investment grade, with a negative outlook, sending the forint currency near a record low and drawing a government accusation that the move was part of a financial attack.

That followed a request by Orban, who has eschewed the austerity traditionally prescribed by the International Monetary Fund in favour of tax cuts for families and small businesses and revenue boosting steps, to relaunch talks with the Fund after the two sides acrimoniously parted ways last year.

It was also an 180-degree turn from his pledge in the 2010 election that he swept with a two-thirds majority to regain Hungary's economic sovereignty by rejecting conditions demanded by rescue lenders.

After a day when the forint fell 1.5 percent against the euro, Economy Minister Gyorgy Matolcsy said Orban and his cabinet would work with the IMF, the EU and Hungary's banks, with which the government has been at odds for more than a year.

Hungary needs a new growth plan and at the same time a financial safety net. In the current situation, only the IMF and the European Union can provide that type of security, Matolcsy told journalists in parliament.

He made clear that Hungary wanted to continue to fund itself on international markets.

But he said the government would seek any type of precautionary credit line the IMF might offer, retreating from Orban's earlier demand that Hungary would only accept a safety net with no strings attached.

Of course we would like the most flexible version of the Flexible Credit Line, but apparently that is not something we can aim for, Matolcsy said. We will choose whichever is more flexible from a Precautionary Credit Line or a Precautionary Standby Agreement. We will negotiate.

CUT TO JUNK

The Moody's downgrade followed months of warnings from it and its two rival ratings agencies and came just hours after Standard & Poor's held fire on a flagged cut to junk after Budapest's approach towards new IMF talks.

Moody's cited rising uncertainty about Hungary's ability to meet fiscal goals, high debt levels and what it called increasingly constrained medium-term growth prospects.

Moody's believes that the combined impact of these factors will adversely impact the government's financial strength and erode its shock-absorption capacity, it said in a statement.

The downgrade spooked investors already nervous about a failed bond tender in Germany this week and worried that the euro zone debt crisis could cause western banks to deleverage from emerging Europe and exacerbate a potential recession there.

Hungarian bond yields soared by about a full percentage point, lifting its entire bond curve above 9 percent, but yields dropped by about 20-30 basis points in afternoon trade as high yields prompted buyers to enter the market.

The cost of insuring Hungarian debt against default jumped to record highs at 635 basis points, eclipsing earlier highs hit in March 2009. The forint rebounded from a morning fall of about 1.6 percent to trade at 315.50 at 1936

GMT.

Analysts polled by Reuters said they expected Hungary's central bank to raise its base rate by at least half and as much as two percentage points to calm markets.

Nicholas Spiro, managing director of Spiro Sovereign Strategy, said that although most of emerging Europe was better off than southern Europe, the euro zone debt crisis and Hungary's downgrade indicated turmoil ahead for the region.

There's no question that sentiment towards the region is deteriorating rapidly and that even the most resilient economies are in for a rough ride in the months ahead, he said.

The forint has fallen 16.3 percent since July 1, versus 12.6 percent for its regional peer the Polish zloty and 6.7 percent for the Czech crown.

SHORT-LIVED SURPLUS

Orban has cut taxes for families and small firms and raised tariffs on banks, utilities and other big, mainly foreign-owned, firms, putting the country of 10 million on track to run one of the European Union's only budget surpluses this year.

But his policies have failed to spur growth and irked voters who resent his aggressive tactics and oppose his seizing private pension savings to fund an inefficient public sector.

The Economy Ministry blamed the currency's plummet -- which has hit Hungarians who have borrowed in foreign currency -- on market speculators. It said the downgrade was unwarranted, the latest in a string of financial attacks against Hungary.

The government cited its commitment to keep the budget deficit below 3 percent of economic output next year, 1 percent of GDP's worth of reserves in the 2012 budget, and an expected decline in debt levels, as arguments against the rating cut.

But Moody's said the government's 2.5 percent of GDP budget deficit target for next year may be difficult to meet due to high funding costs and low economic growth.

Hungary must roll over 4.7 billion euros in external debt next year as it starts repaying part of its 20 billion euros, 2008 bailout from the IMF.

But forint weakness has pushed public debt to 82 percent of annual output, undoing the impact of Orban's pension asset grab.

High unemployment, weak bank lending and 5 trillion forints in mostly Swiss franc denominated foreign currency mortgages, which have seen repayments soar due to the forint's slide, have also hit growth, and Matolcsy said the economy would not reach the government's 1.5 percent growth forecast next year.

Unfortunately that is not realistic. Hungary's growth can be between 0.5 percent and 1 percent, he said.

Senior executives in Hungary's banks also said they would probably face downgrades. They said financing costs would rise but the cut to junk would not lock them out of markets altogether.

Sooner or later all banks will be cut to junk, which is mandatory when the country they operate in is in junk, which will inevitably make financing more expensive, said one senior banker, speaking on condition of anonymity.

(Additional reporting by Gergely Szakacs; Writing by Michael Winfrey; Editing by Catherine Evans, Ron Askew, Kenneth Barry)