BlackBerry has entered into an agreement to sell the majority of its Canadian real estate holdings, a move that would see the company part with three million square feet of space as well as vacant land.

The smartphone maker will lease back a portion of the space, the company said in a release, though it didn't specify how much. 

It wasn't immediately clear who is buying BlackBerry's real estate. The company says it expects to close the deal by the end of June.

The lease issued by BlackBerry notes the sale is "subject to certain conditions, and the transaction may not be completed on the negotiated terms, or at all."

An earlier agreement between the University of Waterloo and BlackBerry saw the university pick up five buildings and land for $41 million in December.

That deal gave the university an additional 300,000 square feet of space and 1,000 more parking spots, while BlackBerry leased back two buildings from the university.