MOSCOW — In a mass public protest with a rare permit, hundreds of critics of the Russian government gathered in Moscow on Tuesday evening to demonstrate against a new set of so-called antiterrorism laws.

Signed into law by President Vladimir V. Putin in July, the legislation introduced what critics have called intrusive measures, including requirements to store all communications data for six months, and phone and texting records for one to three years.

Protesters decried the legislation as an assault on privacy and internet freedom. They gathered in a secluded section of Sokolniki Park, a location chosen by the city government after it rejected more central sites, including one near the Kremlin, proposed by the rally organizers.

For just over an hour, speakers at the rally — activists, politicians and technology experts — called on Russians to resist government attempts to tighten control over the internet, which many view as the last safe space for dissent in Russia.