Shares of UBS rose sharply on Monday as attention turned to details of an agreement ending the Swiss bank's dispute with U.S. authorities over whether it should reveal the identities of thousands of American clients.

The U.S. government and UBS struck a deal in principle on Friday to end tax litigation against the Swiss wealth management giant, heading off a showdown that had threatened to sour relationships between the two countries.

U.S. government sources said the key to any final deal, which could be hammered out in negotiations this week, is whether it will give U.S. investigators details of the biggest American tax evaders doing business with UBS.

A U.S. government source told Reuters on Friday that UBS was not expected to pay a fine as part of the deal, and Swiss newspapers reported the settlement would include the bank handing over 5,000 names of U.S. clients holding secret Swiss accounts -- about 10 percent of the names Washington was after.

A Swiss newspaper had reported that as many as 10,000 names of UBS clients could be transferred to U.S. tax authorities.

At first sight, this looks a good deal for UBS, considering speculation UBS would pay a fine of 2-5 billion Swiss francs and hand over many more names, said Helvea analyst Peter Thorne.

The deal will not formally violate Swiss bank secrecy rules, a top Swiss diplomat said. But the country's reputation for iron-clad secrecy has already suffered from pressure to open up from the Group of 20 rich and major developing countries.

If UBS does not have to pay a fine, this would clearly be positive for the stock price. But we still do not know if this will be the outcome, said WestLB analyst Georg Kanders.

As far as the names are concerned, this would be a compromise. It will probably hurt their business with U.S. clients, but this business is pretty much dead already.

TARGET: 'BIG OFFENDERS'

The number of account holder names to be disclosed by UBS in the agreement was much less significant than what they would represent in terms of the total amount of U.S. assets concealed at the bank, the U.S. government sources said.

If they've really got all the big offenders and 90 or 95 percent of the money, I think it's probably a pretty big victory for the United States, one of the sources told Reuters.

The Swiss might be able to come back and say, 'Well, you know, we protected 25,000 or 30,000 accounts. But basically, they'd end up having to admit that what they protected were the most insignificant accounts, the source added.

The source has followed the UBS case closely but asked not to be identified because he had not been authorized to discuss the matter.

Absence of a fine is especially positive for UBS because it would remove the risk of the bank, which has been hard hit by the mortgage crisis and client withdrawals, having to raise more capital. It has already received state aid and tapped the market for cash to weather the crisis, analysts said.

Shares of UBS were up 5.5 percent at $15.55 in afternoon trading on the New York Stock Exchange after rallying nearly 7 percent on Friday.

ANOTHER DENT IN SECRECY

Analysts said the handing over of some 5,000 client names would further dent already weakened Swiss bank secrecy laws and could put pressure on Swiss banking in general by forcing it to rely less on privacy and become more competitive globally.

Yvan Pictet, a senior partner at Swiss private bank Pictet Cie and president of the Geneva Place Financiere foundation, said in an interview with Swiss television on Sunday that the Geneva-based financial industry was at risk from the deal.

Switzerland's top diplomat, Michael Ambuehl, who led Swiss negotiations in the tax dispute, told newspaper NZZ am Sonntag the deal would not violate Swiss law.

The Swiss legal system is maintained, because the U.S. have promised to act on the basis of the current agreements and to ask for legal assistance again, said Ambuehl, who is state secretary in the foreign ministry.

Swiss law allows for the transferring of bank client data in specific cases of tax fraud, but the country had never faced such a wide-ranging request like the U.S. one. Other countries could use the same route to obtain taxpayer data.

UBS is expected to report a second-quarter net loss of about $1 billion (1.1 billion Swiss francs) on Tuesday, along with billions of wealthy clients outflows.

The withdrawals accelerated after UBS handed over about 250 names in February to settle a separate but parallel criminal probe involving U.S. tax evasions.

(Additional reporting by Tom Brown in Miami and Pascal Schmuck in Switzerland; Editing by Pascal Fletcher and Steve Orlofsky)