LONDON (Reuters) - Britain will reprivatise bailed-out lender Royal Bank of Scotland RBS.L by selling 15 billion pounds ($20 billion) of shares, according to budget documents released on Wednesday, in a boost to finance minister Philip Hammond's coffers.

The government will begin the delayed share sale by selling 3 billion pounds of shares in RBS before the end of the 2018-19 fiscal year and the shares will be sold over five years.

The British government pumped 45.5 billion pounds into RBS in the depths of the financial crisis, and efforts since then to recoup the money have been stymied by the bank’s plunging share price, regulatory probes in the United States and Brexit.

At the current share price of 270 pence, little more than half the 502 pence the government paid for them, the Treasury stands to lose billions of pounds on the sale.

RBS has reported losses of more than 58 billion pounds since 2008 but last month reported a forecast-beating operating profit in the third quarter that lifted its shares.

Peter Hahn, professor of banking at the London Institute of Banking and Finance, said the government had decided to start selling its stake because RBS is close to resolving its problems and the government has accepted it is unlikely to get all its money back.

“The government bought the shares almost 10 years ago, RBS is a very different bank today, so there is no way it can recoup the money it spent bailing it out,” he said. “This is a realisation from the government it is time to move on.”

The sale would represent around two thirds of the government’s 71 percent stake in RBS at current market prices.

A spokeswoman for RBS said the bank welcomed the government’s recognition of the bank’s progress.

A worker cleans the glass exterior next to the logo of RBS (Royal Bank of Scotland) bank at a building in Gurugram on the outskirts of New Delhi, India, September 8, 2017. REUTERS/Adnan Abidi

Britain’s independent Office for Budget Responsibility (OBR) said the government’s expected losses from rescuing failed banks during the 2007-2009 financial crisis narrowed to 21.8 billion pounds from 23.5 billion pounds in March.

The OBR said the government now faces a 26.2 billion pound loss on its stake in RBS, down from a previous forecast of 29.2 billion in March, after a recovery in the value of the bank’s shares.

Nevertheless, the proceeds from the share sale will come as a boon to Hammond, who on Wednesday delivered a gloomy budget statement to parliament warning of lower tax revenues. The share sale will help achieve a fall in public sector net debt as a share of GDP.

A government plan to sell part of its RBS stake was scrapped last year in the wake of the Brexit vote.

Earlier this year, RBS resolved one of the two major obstacles preventing the government selling its stake in the lender.

European Union regulators freed RBS from an obligation to sell more than 300 branches, bringing to an end the bank’s seven-year struggle to meet conditions for its bailout.

Instead, the regulators accepted a plan for RBS to set up a fund to increase competition in the small-business market.

That left as the remaining major legal obstacle a claim by the U.S. Justice Department that the bank, like many of its peers, mis-sold toxic mortgage-backed securities in the run-up to the financial crisis.

RBS Chief Executive Ross McEwan has said he expects to settle the case this year, although formal talks have not started.

McEwan and bank investors alike see resolving the case, which analysts have estimated could lead to a fine of as much as $12 billion, as a prerequisite for the bank being able to exit government ownership.

RBS shares fell by 1.25 percent by 1630 GMT, against a 0.4 percent rise in the STOXX European banks index .SX7P.

The government also said on Wednesday it expects to sell off the last remaining assets of the failed lenders Northern Rock and Bradford & Bingley by 2021.

($1 = 0.7540 pounds)