(CNN) Rights groups have denounced a new law in New Zealand under which travelers can be fined thousands of dollars if they refuse to allow border officials access to their phone.

Under the Customs and Excise Act 2018 , which came into force this week, officials will be able to demand travelers unlock any electronic device so it can be searched. Anyone who refuses can face prosecution and a fine of up to $3,200 (5,000 NZD).

Officials can also retain devices and potentially confiscate them from travelers who refuse to allow a search at the border.

The New Zealand Council for Civil Liberties (CCL) described the new law as a "grave invasion of personal privacy of both the person who owns the device and the people they have communicated with."

"Modern smartphones contain a large amount of highly sensitive private information including emails, letters, medical records, personal photos, and very personal photos," the group's chairman Thomas Beagle said in a statement