WELLINGTON, New Zealand — After months of growing pressure, the government of Prime Minister Jacinda Ardern of New Zealand abolished on Friday a policy restricting refugees from Middle Eastern and African countries, a curb imposed by the previous government that refugee advocates called discriminatory and racist.

The reversal of the decade-old rule set New Zealand in opposition to the increasingly restrictive refugee policies of allies like Australia and the United States. Last week, the Trump administration announced a sharp cut to the number of refugees it will accept, and Australia’s system of offshore detention of refugees arriving by sea continues to draw international condemnation.

The move also lifts a political millstone from around the neck of Ms. Ardern, who has been perceived globally after the Christchurch mosque attacks in March as a champion of migrants and refugees. For months, she had been forced to deny that the policy amounted to discrimination because one of her key political allies supported it.

The restriction, introduced by the center-right government that preceded Ms. Ardern’s center-left government, which has been in power for nearly two years, allowed refugees from Middle Eastern or African nations to resettle in New Zealand only if they could prove they already had relatives there.