OTTAWA, Ontario — Prime Minister Justin Trudeau’s government announced Thursday it will ban foreign investors from buying homes in Canada for two years in a bid to cool off a hot housing market.

Finance Minister Chrystia Freeland took a number of measures to tamp down speculation and demand amid record home prices in announcing the federal budget for the year.

The government announced a two-year ban on foreign homebuying as well as higher taxes for people who sell their home within a year, though both measures include multiple exceptions including for permanent residents and foreign students.

Rising mortgage rates add to affordability squeeze for Seattle-area homebuyers

The budget also includes billions for new housing and measures to help Canadians trying to get into the market, including a new savings account and changes to the first-time homebuyers tax credit.

The government is under pressure to cool an overheated market after prices climbed by more than 20% last year, while rental rates have also been rising.

More