A group of Canadian General Motors dealers settled their battle with the automaker out of court Monday, the CBC has learned.

The 21 dealerships launched a lawsuit against GM after it ordered more than 250 of them to wind down operations in May 2009.

The company, which emerged from bankruptcy protection recently and announced plans for an initial public offering, had planned to cut more than one-third of its Canadian dealerships by October 2010 to reduce costs and streamline its business.

It also planned to eliminate about 1,100 dealerships in the United States.

As part of the out of court settlement, a number of dealers will continue to operate while others took a cash buyout and will shut down by October.