* UBS CEO sees encouraging signs despite expected Q2 loss
* Gruebel says bank must do everything to stop outflows
* US row must not keep UBS from returning to profitability
(adds details, background)
ZURICH, July 14 (Reuters) - Switzerland's UBS, the world's second largest wealth manager in terms of assets, is on the right path to leave the crisis behind, its chief executive said in an internal memo to staff.
In the letter seen by Reuters, CEO Oswald Gruebel noted "encouraging signs" as operating results improved in the second quarter despite an expected loss.
But the bank had yet to stop outflows of client assets. "We must do everything ... to stop these outflows, which we began to see especially after the February settlement with the U.S. authorities, as fast as possible," Gruebel said.
UBS, an icon of Swiss banking, is struggling to rebuild its once powerful brand after massive investments into risky U.S. assets forced it to make more writedowns than any other European bank. It posted the biggest annual loss in Swiss corporate history and had to be rescued by the state last year.
"We are on the right path to leaving this crisis behind us," Gruebel said in the memo. "Now is the time to turn around and only look straight ahead," he said.
The bank said at the end of June it expected another loss in the second quarter.
The bank, which is due to report results on Aug. 4, is also at the centre of an high-profile tax litigation that is seeking to force it to disclose the identity of 52,000 client names.
Gruebel said in the memo he welcomed the Swiss government's efforts to negotiate a solution. "It is critical that these proceedings do not prevent us from achieving our much more important goals -- returning to profitability and rebuilding our reputation," he said.
UBS shares extended earlier gains on the Gruebel comments, trading 3.5 percent higher at 13.70 Swiss francs by 1553 GMT, outperforming the Dow Jones Stoxx European banks index which was 2.6 percent firmer.
(Reporting by Sven Egenter; editing by Elaine Hardcastle)