Security guards patrol the popular shopping and nightlife area of Sanlitun in Beijing on Dec. 26, 2015. Greg Baker/AFP/Getty Images

China passed the country's first counterterrorism law Sunday, aimed at addressing terrorism at home and helping maintain world security, Xinhua reported. The draft legislation had drawn criticism from the United States, which cited concerns that the law may be used to force foreign technology companies, including American ones, to assist Chinese authorities in snooping.

Chinese lawmakers approved the legislation Sunday afternoon, at the end of a weeklong bimonthly session of the National People's Congress (NPC) Standing Committee. An overwhelming 157 legislators of the 158 present voted in favor of the law, state-run news agency Xinhua reported.

U.S. concerns have centered on the technology provisions in the law, which make it mandatory for telecommunication companies and internet service providers (ISPs) to install "back doors" in their servers that can be accessed by the government, and also to make available to public security agencies any data stored on the servers. The law also requires ISPs to locate their servers in China and to store all the user data from China locally, as well as to disclose their data encryption methods to the government.

U.S. President Barack Obama said in March, during an interview with Reuters, that the law “would essentially force all foreign companies, including U.S. companies, to turn over to the Chinese government mechanisms where they could snoop and keep track of all the users of those services.” He added that it was a concern he had raised directly with President Xi Jinping of China.

Earlier in the week, the U.S. State Department expressed “serious concerns” about the law, saying it would do more harm than good to the fight against terrorism, another Reuters report said.

Responding to a question about U.S. concerns over the draft legislation at a press briefing Wednesday, Hong Lei, a spokesman for China’s Foreign Ministry rejected the criticism, saying: “We hope the United States will stop groundless accusations and respect China's law-making processes,” Xinhua reported.

He also referred to similar requirements in U.S. laws that ask companies to provide technical assistance to investigators, and urged the U.S. to refrain from using “double standards,” Bloomberg reported.

Before this law came into effect, China did not have a specialized counterterrorism law, though there were related provisions in various NPC Standing Committee decisions, as well as the country’s criminal law, criminal procedure law and emergency response law.

Over the last two years, China has been dealing with an increasing number of attacks, especially in the restive northwestern province of Xinjiang, including knife attacks at crowded train stations, and an automobile crashing into a group of pedestrians in Beijing's Tiananmen Square in October 2013, which killed five people. China has described these attacks as acts of terror and blamed them on the local Muslim Uighur minority, who in turn accuse the government of persecution.