In this file photo taken on Aug 3, 2020, a HSBC logo is pictured on a wall outside a branch of the bank in central London. (DANIEL LEAL / AFP)

LONDON – HSBC has agreed to sell its business in Canada to Royal Bank of Canada for $13.5 billion Canadian dollars ($10.04 billion) in cash, paving the way for a potential bumper payout for shareholders later down the line.

HSBC, which once billed itself as the world's local bank and built a global network of retail banking businesses, has in recent years been cutting those back in a bid to improve profits.

HSBC said it may return some of the proceeds of the sale, expected to net the bank a $5.7 billion pre-tax gain, to shareholders via a one-off dividend or buyback from early 2024 onwards, after the deal has closed

"We decided to sell following a thorough review of the business, which assessed its relative market position within the Canadian market and its strategic fit within the HSBC portfolio," Chief Executive Noel Quinn said.

HSBC said it may return some of the proceeds of the sale, expected to net the bank a $5.7 billion pre-tax gain, to shareholders via a one-off dividend or buyback from early 2024 onwards, after the deal has closed.

ALSO READ: HSBC eyes sale of multibillion-dollar Canadian business

Joe Dickerson, an analyst at Jefferies in London, said that could go some way towards appeasing shareholders who were incensed by the bank curtailing dividends in 2020, at the suggestion of British regulators.

HSBC's shares were up 4 percent following the announcement, against a benchmark FTSE 100 index up 0.7 percent.

"The transaction looks very sensible. In essence, the business is worth more to RBC than it is to HSBC, and the price reflects this," said Ian Gordon, banking analyst at Investec.

The deal also repairs what was an uncharacteristically weak capital position relative to HSBC's peers, Gordon said.

ALSO READ: HSBC toughens thermal coal policy to curb climate change 

The purchase will enable RBC to take more market share in its home market, adding 130 branches and more than 780,000 retail and commercial customers. If successful it will be the first big banking merger in a decade in Canada.

HSBC is Canada's seventh biggest bank with assets of C$125 billion, and it earned C$490 million before tax as of June 30, based on its latest financial results. Analysts had valued HSBC's Canada business in the range of C$8 billion to C$10 billion.

The sale to RBC is expected to attract scrutiny from Canada's antitrust agency as the country's banking market is heavily concentrated, with the top six lenders controlling about 80 percent of the total assets, based on Reuters calculations.

READ MORE: HSBC raises profitability goal, seeks to rebuff call for break-up

HSBC hired JP Morgan to advise on the sale, Reuters previously reported.