A worker checks cars made by GM Korea in a yard of GM Korea's Bupyeong plant before they are transported to a port for export, in Incheon, west of Seoul August 9, 2013. REUTERS/Lee Jae-Won

By Jeffrey Hodgson

TORONTO (Reuters) - The Canadian government said on Tuesday it had a deal to sell nearly a quarter of its common shares in General Motors Corp , part of a longer-term plan to shed the stake it acquired when it helped bail out the automaker.

The government said in a statement it will sell 30 million GM common shares in a block trade to Bank of America Merrill Lynch and RBC Capital Markets, a unit of Royal Bank of Canada .

It said the shares were sold at the closing market price on Tuesday, minus a small discount. GM shares finished the session at $37, putting the value of the stake at about $1.11 billion.

Canada GEN Investment Corp., the government's holding vehicle for its GM stake, will still own more than 110 million GM common shares when the deal closes on September 16. It will also hold more than 16.1 million preferred shares.

"As we said from the start, our investment in GM was always meant to be temporary as we worked to maximize the return to Canadian taxpayers," Finance Minister Jim Flaherty said in a statement.

"The Government of Canada is committed to exiting from ownership of GM as quickly as feasible, while maximizing the return for Canadian taxpayers, as we demonstrated today."

The governments of Canada and the province of Ontario, the heartland of the country's auto sector, became shareholders of GM in 2009 when they together contributed more than C$10 billion ($9.66 billion) to a bailout to keep GM afloat.

In return for their investment, the two governments required that the automaker maintain its share of production in Canada for several years moving forward.

The U.S. Treasury said last December that it plans to sell its entire stake in GM over 15 months.

($1 = $1.0356 Canadian)

(With additional reporting By Louise Egan in Ottawa and Dan Burns in New York; Editing by Ken Wills)