Royal Bank of Scotland reported more losses on Friday as investment banking profits failed to offset bad debts, and the state-controlled lender warned of more poor results to come before a lasting recovery.

There will be no miracle cure. There will be a couple of years of heavy lifting ahead, both for RBS and for the world economy, Chief Executive Stephen Hester said.

This will be a marathon, not a sprint.

The bank's 1 billion pound ($1.7 billion) net loss in the first six months of the year disappointed market hopes of a half-year profit after a relatively rosy week for UK banks, and the news wiped out gains made in RBS shares this week.

Hester struck a further note of caution by telling investors that buoyant investment banking conditions, which have helped first-half earnings across the sector, were likely to ease back to normal in the coming months. The bank is also experiencing damaging departures among top-performing staff.

But RBS also reassured investors it was pushing ahead with its turnaround, naming a heavyweight U.S. banker as the new finance director and setting a raft of targets for 2013.

Hester, in line for a multi-million pound bonus if RBS succeeds in its revival, said he would be disappointed if the government did not have plenty of opportunity to sell out profitably over the next five years.

RBS's shares, however, were trading at 47.13 pence at 1437 GMT on Friday, down 11.8 percent, off earlier lows but still below a key 50.5p level -- the average price paid by the UK government for RBS shares. In currency markets the pound slipped against the dollar after the RBS earnings.

I think it's a reality check, frankly, analyst Leigh Goodwin at Fox-Pitt, Kelton said.

We were hoping, after the optimism of the last few days, that maybe with a good performance in (investment banking) and some stabilization of credit, we might all be feeling that it was all a bad dream with Royal Bank. But we're back to reality.

RBS's headline net loss attributable to shareholders, which includes a 4.2 billion pound gain from debt buybacks and disposals, compares with a year-ago loss of 827 million pounds.

Bad debts in the first half jumped to 7.5 billion pounds, more than five times the year-ago level, while writedowns came in at 4.3 billion, mostly from exposure to monoline insurers.

NOT OVER YET

UK rival Lloyds Banking Group , in which the government has a 43 percent stake, gave investors hope this week when it said the worst was over for its bad loans and hinted a recovery could be around the corner.

But RBS, itself 70-percent owned by the UK government, struck a more cautious note on Friday, warning that results would be poor over the next two years, with no substantial improvement before 2011.

Hester said it was still too soon to say whether the market had seen the high-tide mark for impairments.

It's not impossible that we should be more optimistic now, but I am not going to call the turn today -- we need more evidence, he told reporters.

Even if the technical peak is either near or has passed, it will be some years before impairments subside. One needs to be cautious at overinterpreting short-term indicators.

Some 70 percent of RBS's first-half impairments and writedowns will be included in a government-backed Asset Protection Scheme (APS) to limit its exposure to losses on loans. A deal is expected in the autumn but RBS executives gave no further detail on the talks.

That level would imply RBS has already used up a large part -- over 8 billion pounds -- of the 19.5 billion first loss liability under the APS, bringing it closer to dipping its hand into taxpayers' pockets once again as early as next year.

Hester said the first loss would likely be exceeded in coming years.

RBS said its core bank -- which excludes assets the bank aims to sell or wind down -- had an operating profit of 6.3 billion pounds, up from 4.7 billion a year ago. Its non-core operations, however, sank to a loss of 9.6 billion pounds.

The non-core operation also accounted for some 70 percent of its impairments, the bank said.

Global Banking and Markets, RBS's investment banking arm, posted a first-half profit after impairment losses of 4.87 billion pounds, up from 1.12 billion a year ago as it benefited from boom conditions in sectors including fixed income that have also helped rivals such as Barclays and HSBC .

Commercial and retail banking, however, was hit by lower revenues and margins and higher bad debts.

Its key net interest margin fell to 1.69 percent from 2.07 percent. Margins, hit by higher funding costs, are expected to be slightly lower in the second half, though a little better in 2010. RBS targets a 2009 margin of around 1.6 percent.

Lending to small businesses, a key issue for Britain and a critical demand for state-supported banks, fell in the six months as loan applications dropped. The bank said its government target could be challenging as customers remained cautious, but said it comfortable it was meeting its commitment.

As part of its turnaround plans it also set a string of targets to be reached by 2013, including a return to an AA credit rating, a return on equity of at least 15 percent and a cost income ratio of less than 45 percent.

The bank, which slashed costs by 8.7 billion pounds in the first half, said it also expects further job cuts beyond the already announced 16,000 headcount reductions.

The bank also named former Bank of New York Mellon chief financial officer Bruce Van Saun as its new finance director, completing the overhaul of its top team.

(Additional reporting by Steve Slater; Editing by Greg Mahlich)