Prime Minister Viktor Orban's government is struggling to repair tattered ties with the European Union so it can secure a credit lifeline from it and the International Monetary Fund and stave off potential insolvency.

The lenders have piled pressure on Orban since the start of the year telling him to change new laws on media, the courts and the central bank that they say undermine their independence and breach EU rules.

Orban, dubbed "the Viktator" by critics who fret over his efforts to centralize power, has said he will rework several laws but the decision would be up to parliament, which his Fidesz party controls.

Financial markets are looking for proof he is serious, particularly after thousands of Hungarians marched in support of his policies on Saturday.

He said the cabinet would work out the details by Monday, a day before he heads to Brussels to meet European Commission President Jose Manuel Barroso.

"I think the deal will be struck by March or April," Orban's state secretary, Mihaly Varga, told TV2. He said he made the assumption considering it took a month for Budapest to arrange an earlier loan package when the economic crisis hit in 2008.

When asked if media estimates that the package could be for 17-20 billion euros, Varga said they were probably not far off.

The Commission launched infringement procedures against Budapest last week, zeroing in on legislation concerning the central bank, which allows for the merger of the bank with the financial regulator and lets Orban name a third deputy Governor, among other changes.

Hungary wants the loan package to rebuild market confidence before it has to borrow nearly 5 billion euros on top of regular forint-debt refinancing to pay back both bondholders and an earlier IMF/EU loan package this year.

MARKETS WARY

The forint rallied further on Monday, rising over one percent from opening levels to 299.6 per euro on hope that Orban's meeting with Barroso on Tuesday could bring a deal closer.

Having demonized the IMF since taking power and broken off talks with them in a first deal in 2010, Orban executed an about face this month after investors fled Hungarian assets, driving the forint to a record low 324 per euro and bond yields to a prohibitively expensive 11 percent.

Now those yields have stabilized at high levels of over 9 percent, and analysts say investors will remain on guard due to tetchy relations with the IMF and EU.

"The Hungarian government has disappointed too many times for investors to believe everything the Hungarian government is saying," said Lars Christensen, an analyst at Danske Bank.

"On our own part we would like to see a shift change in the central bank law to ensure central bank independence before we fundamentally can get more positive on the outlook."

A survey showed on Monday that confidence among consumers had plunged to its lowest level in over two years with expectations turning more grim in every sector, led by the industrial and services sectors, as well as households.

Hungarians are particularly squeezed by a massive burden of foreign currency loans taken out, usually in Swiss francs, before the 2008 crisis on the bet that the forint would strengthen.

But the forint has since dropped over 40 percent against the franc, causing monthly mortgage payments to skyrocket and forcing regular Hungarians to cut back to the basics.

Polls show 84 percent of people think Hungary is going in the wrong direction but on Saturday, over 100,000 people marched in Budapest to show support for Orban's government in a rally marked by speeches from organizers vowing to fight against becoming "a colony" of the West.

Analysts said the size of the rally was a signal that Orban's Fidesz party remained the most popular political force in the central European state of 10 million.

It dwarfed a demonstration of tens of thousands on January 2 by opposition protesters against the new constitution, pushed through by Orban's two-thirds majority in parliament.

The vocal domestic support could give a Orban, a hard charging politician who does not shy away from controversy, impetus to drive a hard bargain in talks with the EU and IMF.

"The risks still are of a long drawn out process of moving to conclude an agreement and even thereafter tortuous discussions around the regular IMF/EC reviews," said Tim Ash, head of CEEMEA research at bank RBS.

(Writing by Michael Winfrey; editing by Anna Willard)

By Gergely Szakacs and Marton Dunai