HANOI (Reuters) - Vietnam’s new cybersecurity law is designed to protect online rights and create a “safe and healthy cyberspace,” the foreign ministry said on Thursday, although critics have warned it gives the Communist-ruled state more power to crack down on dissent.

Seventeen U.S. lawmakers wrote to the chief executives of Facebook and Google on Wednesday, urging them to resist changes wrought by the new law that require foreign tech firms to store locally personal data on users in Vietnam and open offices there.

“As in any other country, the activities of foreign businesses and investors should comply with the laws of the host country,” foreign ministry spokeswoman Le Thi Thu Hang told Reuters in a comment on Wednesday’s letter.

“The ratification of the cybersecurity law is aimed at creating a safe and healthy cyberspace,” Hang said in a written statement in response to a request for comment.

That would protect the legitimate rights and interests of organizations and individuals online, and ensure national security as well as social order and safety, she added.

Despite sweeping economic reforms and growing openness to social change, Vietnam’s Communist Party tolerates little dissent.

Global technology firms have pushed back against the requirement to store user data locally, but have not taken the same tough stance on the parts of the law that bolster the government’s crackdown on online political activism.

In particular, the new law gives more direct control over online censorship to the Ministry of Public Security, which is tasked with crushing dissent.

Foreign ministry spokeswoman Hang did not directly address those accusations, as outlined in Wednesday’s letter from U.S. lawmakers, but said freedom of speech was a right enshrined in Vietnamese law.

“The state of Vietnam always respects and facilitates the rights of its citizens to exercise freedom and democracy but is resolutely against the abuse of those rights to commit illegal activities,” Hang added.

Approved by Vietnamese legislators last month, the law takes effect on Jan. 1 next year.