UBS has moved closer toward ending state involvement in the bank after it raised $3.5 billion of new capital, but must still settle U.S. legal problems and stem client withdrawals to return to health.

UBS , the world's largest wealth manager and one of the major banks hit hardest by the financial crisis, said late on Thursday it was to place 293.3 million new shares at 13 francs a share with a few big institutional investors.

It also said it expected to post a second-quarter loss due to debt and restructuring charges although its operating results, helped by improved investment banking conditions and lower losses and writedowns, should be better.

The Swiss National Bank and banking regulator FINMA have indicated they want UBS to strengthen its capital base before the government withdraws a 6 billion Swiss francs ($5.5 billion) investment made in October to bail out the bank.

We welcome that the bank has strengthened its capital base, FINMA head Eugen Haltiner told Reuters on Friday on the sidelines of a banking event in Basel. We can call the bank well capitalized ... The bank is now prepared to weather an unexpectedly difficult economic scenario.

UBS stock extended Thursday's 6 percent loss to fall a further 3.6 percent to 13.46 francs by 1432 GMT, while shares in rival Credit Suisse were up 4.2 percent at 48.34 francs and the DJ Stoxx European banking sector index <.SX7P> gained 0.4 percent.

Nicolas Michellod, from Boston-based financial research and consulting firm Celent, said UBS was taking advantage of relative calm in the financial markets to raise cash with the ultimate aim of ending government involvement in the bank.

The goal overall is to get back to a normal modus operandi and get rid of political forces influencing strategic decisions at the top of the bank, he said.

SWISS FINISH

Analysts said UBS had to boost its capital base due to pressure from FINMA, which is imposing tougher standards than the international minimum, demanding a Tier 1 capital adequacy ratio of at least 12 percent of risk-weighted assets by 2013.

We welcome the strengthening of UBS's rather thin capital base but we don't like the resulting dilution for existing shareholders, said Sarasin analyst Rainer Skierka.

The second-quarter results indications do not surprise but show that UBS is not out of the woods yet.

UBS said the share placing -- a dilution of about 10 percent -- would help increase its Tier 1 ratio to a proforma 11.9 percent from 10.5 percent on March 31 although the quarter's figure should be higher due to continuing cuts in risk-weighted assets.

Credit Suisse said in April it has a Tier 1 ratio of 14.1 percent, making it one of Europe's best capitalized banks.

UBS also said on Thursday it had seen net client outflows in its three wealth and asset management units so far this quarter.

A string of negative headlines about UBS in the past year has prompted big client withdrawals, particularly over a U.S. case seeking the names of 52,000 Americans suspected of using the bank to hide nearly $15 billion in assets from the taxman.

The U.S. Justice Department denied earlier this week it was planning to drop the case and said it would file a brief seeking an enforcement of the summons on June 30 although it was still willing to consider a settlement.

Merrill Lynch analyst Derek de Vries said that to turn positive on UBS he wanted to see net new money inflows, a disposal of the Swiss government stake, a resolution of the U.S. tax case and a clearer communication of strategy by management.

The decision to raise 3.8 billion francs in the market doesn't change our investment thesis as we continue to worry about a number of issues at the bank, he said.

Switzerland said earlier this month it was in talks over its investment in UBS with various parties but had not yet decided to convert its mandatory convertible notes -- that would give it a 9.3 percent stake in the bank -- or sell them.

To support the capital raising, the government said it had agreed not to sell any UBS shares before August 4 -- when second-quarter results are due -- without UBS's consent.

SNB Vice-Chairman Philipp Hildebrand said last week a sale of the government stake could be a positive signal but everything had to be done to improve UBS's resilience first.

It's certainly something the national bank welcomes, SNB spokesman Werner Abegg said on Friday. UBS's resilience has been improved in times when the economic situation could make things difficult.

(Additional reporting by Rupert Pretterklieber; Writing by Sam Cage and Emma Thomasson; Editing by Dan Lalor and Erica Billingham)

($1=1.099 Swiss francs)