UBS could be facing a total bill running to nearly 40 million Swiss francs ($36.97 million) after the Swiss government said on Tuesday it would pass on to the bank the costs of intervention in a bitter U.S. legal battle.

UBS and the Swiss government agreed in August to disclose 4,450 secret accounts that U.S. citizens used to hide money from tax authorities to settle the tax dispute.

The Swiss government said legal costs from the case ran to 2.5 million francs to date, with 1 million francs in costs occurring from negotiations with U.S. authorities in 2009 and 1.5 million francs of costs from administrative assistance -- the process of handing over client data -- given to the United States in 2008.

Costs from an ongoing second round of administrative assistance resulting from the agreement struck with the United States last year were estimated by the Swiss finance ministry to come to 37 million francs.

Switzerland will ask parliament to turn the deal with Washington into binding law, plugging a legal hole that is stopping Berne from honoring the agreement.

(Reporting by Jason Rhodes, editing by Leslie Gevirtz)