New Zealand has banned most foreigners from buying homes as it tries to tackle runaway housing prices.
Previously the housing market was open to investors worldwide, but the government on Wednesday passed legislation that allows only New Zealand residents to buy homes.
In recent years, there have been many anecdotal stories of wealthy foreigners from Silicon Valley and beyond buying ranches in picturesque rural New Zealand as a "bolt hole" or escape option from a turbulent world.
There have also been stories of wealthy Chinese buyers outbidding New Zealanders on suburban homes in the main city of Auckland.
Statistics indicate about 3% of New Zealand homes are being sold to foreigners, but the amount rises to 5% in the scenic Queenstown region and 22% in central Auckland.
Last month, the directors of the International Monetary Fund executive board said they encouraged New Zealand to reconsider the ban, which they thought would be unlikely to improve housing affordability.
But the government says there is no doubt that foreigners are driving up prices, and the only question that remains is by how much. The new law fulfils a campaign pledge by the liberal-led government which came to power last year.
There are some exceptions. Foreigners with New Zealand residency status will still be able to buy homes, as will people from Australia and Singapore, thanks to existing free-trade agreements.
Foreigners who already own homes in New Zealand will not be affected. And overseas buyers will still be able to make limited investments in large apartment blocks and hotels.
"We're here today to take another step toward restoring the great New Zealand dream of home ownership," said Associate Finance Minister David Parker.
He said it was the birthright of New Zealanders to buy homes at a fair price.
"This government believes that New Zealanders should not be outbid by wealthier foreign buyers," Mr Parker said.
"Whether it's a beautiful lakeside or oceanfront estate, or a modest suburban house, this law ensures that the market for our homes is set in New Zealand, not on the international market."
Opposition politician Judith Collins said the bill was unnecessary.
"We oppose the bill because we don't believe that it actually fixes any problem," Ms Collins said. "It is, in fact, nothing more than an attempt to justify some of the policies of the incoming government."
Skyrocketing home prices in Auckland have been of particular concern to New Zealanders, although that market has cooled over the past year.
Still, prices there remain among the most expensive in the world when compared with people's incomes.
Figures released on Wednesday by the Real Estate Institute of New Zealand indicate the median house price in Auckland is 835,000 New Zealand dollars (€483,000) 547,000 while the median price across the country is 550,000 New Zealand dollars (€318,000).