Switzerland will hand over details of about 4,450 UBS 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.

The agreement ends a row which 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, 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.6 percent at 16.63 Swiss francs by 1413 GMT (10:13 a.m. EDT), having reversed some of their earlier losses after the announcement. Swiss rival Credit Suisse was down 1.0 percent and Julius Baer dropped 0.5 percent.

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, and affects about 4,450 accounts, the Swiss government said. Precise details will be published 90 days after the agreement comes into force.

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.

(Additional reporting by Steve Slater in London; Writing by Sam Cage; Editing by Erica Billingham)