A new law has come into effect in Thailand that curbs public gatherings and bans protests at the prime minister's office, airports and various other public places.

Human rights groups have criticized the Public Assembly Act and its stiff penalties. It is the latest restrictive measure put in place since the military ousted an elected government in a coup last year. The coup followed years of political demonstrations that led to violence and often paralyzed the country's capital.

The law that took effect Thursday requires protesters to inform police about rallies at least 24 hours before they are held. It bans demonstrations within 150 meters (500 feet) of government offices, courts, airports, train and bus stations.

Deputy government spokesman Sansern Kaewkamnerd called the law "a necessity for Thailand."