The government will not compromise on the question of national security and actions undermining racial sensitivities, and will act against those who pose a threat in these areas, said Datuk Seri Najib Razak.

The Prime Minister said anyone, whether they were participants of the Bersih or Red Shirt rallies, would have to face the law if they had gone against the orders of the authorities.

"The government introduced the Peaceful Assembly Act 2012 because, to me, it is important to give room for the people to express themselves. Otherwise, they will find other ways to make known their views," he said in a post on his Twitter account and blog, najibrazak.com.

He had also uploaded a two-minute audio recording of the statement.

Najib said the recent Bersih rally was declared unlawful because the aim was to topple the government and demonstrate in the vicinity of the venue for the National Day parade.

The rally went ahead, nevertheless, without the authorities stopping it, he said.

Najib said that at the same time some people questioned the decision of the authorities to allow the Red Shirt rally.

"I was informed by the police that permission was given because, firstly, their intention was not to topple the government, secondly, no preparations for a parade were being made where they wanted to demonstrate and, thirdly, they had obtained the approval of DBKL (Kuala Lumpur City Hall).

"When some of the demonstrators wanted to breach the security barricade, the authorities used the water cannon on them," he said.

Najib said the police were looking for those demonstrators who had expressed racial sentiments during the rally and the alleged offenders would be prosecuted under the Sedition Act.

The 'Himpunan Rakyat Bersatu' or Red Shirt rally took place at the Padang Merbok last Wednesday, led by the Federation of National Silat Associations or Pesaka.

It was held to reciprocate the Bersih 4 rally held in the vicinity of Dataran Merdeka on Aug 29 and 30.