Switzerland will hand over details of about 4,450 UBS AG bank accounts to U.S. authorities, settling a tax dispute that has threatened Swiss banking secrecy, the two governments said on Wednesday.

The Swiss government has also agreed to review and process requests by the United States seeking information from Swiss banks besides UBS about account holders who may have tried to evade U.S. taxes, the U.S. government said.

This announcement today should send a signal - no matter

what institution you're with, the IRS is willing to pursue both the institution and the individual, Internal Revenue Service commissioner Doug Shulman told reporters.

Shulman said the accounts were at one time worth $18 billion, but he could not provide a current figure.

The agreement ends a dispute that has strained relations between the United States and Switzerland and challenged the latter's jealously guarded bank secrecy laws.

It could help UBS, the world's second-largest wealth manager, restore an image that has been battered by the financial crisis and the U.S. dispute, and may open the way for the Swiss government to sell its stake in UBS.

It's good to get this out of the way but the confidence of a lot of clients has been compromised so I'm not sure we will see inflows return in Q3. It will take time to recover reputation from this, said Jaap Meijer, an analyst at Evolution Securities in London.

Switzerland's Finance Minister Hans-Rudolf Merz said the government wants to sell its stake as quickly as possible and while it would be good business, it also has to consider other factors.

UBS shares were down 1 percent at 16.74 Swiss francs, having reversed some of their earlier losses. Swiss rival Credit Suisse was down 1.3 percent and Julius Baer dropped 0.7 percent.

UBS Chairman Kaspar Villiger said the agreement helps resolve one of UBS' most pressing issues. I am confident that the agreement will allow the bank to continue moving forward to rebuild its reputation through solid performance and client service.

NEW TREATY

The new treaty between the United States and Switzerland would allow action in the case of tax fraud and the like in the UBS case, the Swiss government said. Precise details will be published 90 days after the agreement comes into force.

The U.S. government retains the right to go back and use a summons to collect the names, which roughly equal the number of accounts, if the enforcement process fails, Shulman said.

The client accounts to be disclosed will likely belong to people suspected of committing tax fraud under the terms of a double taxation agreement that obliges Switzerland to provide help if Washington seeks it in a criminal investigation.

Shulman would not comment on whether the IRS has any open probes of other banks.

The IRS is now gaining institutional skill and knowledge in how to pursue these types of cases and they're going to use that. This is, I believe, the beginning and not the end, said Peter Hardy, a former federal prosecutor and specialist in white-collar crime at Post & Schell in Philadelphia.

(Additional reporting by Steve Slater in London and Jeremy Pelofsky in Washington; Editing by Erica Billingham and Tim Dobbyn)