Mattamy Homes, the largest privately held homebuilder in North America, is packing it up in the Twin Cities.

The Toronto-based company, which has had operations in the Twin Cities since 2003, is selling the bulk of its holdings here to CalAtlantic Homes and M/I Homes Inc., which already have a presence in this market.

In 2015, Mattamy built 295 units worth $109 million, making it the fifth largest builder in the Twin Cities, according to the latest annual survey by the Builders Association of the Twin Cities.

Peter Gilgan, founder and chief executive of Mattamy Homes, said in a statement Wednesday that Minnesota was Mattamy's first expansion outside the Toronto area to produce solid results for the firm. But he added the region is no longer a good fit.

"CalAtlantic Homes and M/I Homes both have a much larger presence in the Midwest, and should benefit from the economies of scale afforded by this concentration," Gilgan said.

Mattamy will divest of all its holdings except for a development in Lino Lakes, but it will continue to develop unfinished lots and finish the houses it's in the process of building.

The company has houses in Bayport, Carver, Chaska, Lakeville, Minnetrista, Otsego, Shorewood, Victoria and Waconia. In 2015, the company paid $15.2 million for the former site of the Minnetonka Country Club, one of the oldest golf courses in the region.

Mattamy spokesman Brent Carey said the company is selling a total of 1,493 single-family and townhouse lots. Terms of the deal, which is subject to a 45-day due-diligence period, weren't disclosed and it is expected to close in April.

In the U.S., the company is based in Orlando and has operations in nine metropolitan areas, including Charlotte, N.C., Phoenix and Tucson, Ariz. Despite its exit from the Twin Cities, Mattamy said that it plans to reinvest the proceeds from the sale to help double the size of its operations elsewhere in the U.S.

The departure isn't the first of a big homebuilder in recent years in the Twin Cities. In March 2016, New Jersey-based K. Hovnanian Homes, said that it was pulling up stakes.

Because of the harsh winters, the Twin Cities is known as a difficult market for companies that don't have experience building in such a climate. And the region also has a reputation for having particularly thin margins because of what many builders say are unusually high fees for permits, utilities and other entitlement expenses.