The Security Bureau on Monday condemned the United Nations Human Rights Office and the Hong Kong Journalists Association (HKJA) for what it called the smearing of police enforcement actions over the June 4 weekend.
The force earlier said it detained 23 people - 11 men and 12 women between the ages of 20 and 74 - for suspected public order offences on Hong Kong Island on Sunday. It said they were taken to police stations but not arrested, and were later released.
A 53-year-old woman was arrested for allegedly obstructing a police officer.
A number of others were arrested or detained in Causeway Bay on Saturday on suspicion of disorder in public places, doing an act or acts with seditious intent or breaching the peace.
The office of the UN High Commissioner for Human Rights said it was "alarmed" by the detentions in Hong Kong that it linked to the anniversary of June 4 and called on authorities to fully abide by the International Covenant on Civil and Political Rights, while the HKJA accused police of obstructing the press by taking away a reporter that day without explaining why.
In a statement, the Security Bureau said the organisations had made "fact-twisting and unfounded remarks" under the guise of freedoms of speech, assembly and the press.
It said that all law enforcement actions were based on evidence and the acts of the people concerned, and had nothing to do with their political stance or background.
"It would be totally contrary to the rule of law for someone to suggest that certain groups of people could enjoy privileges and break the law without getting arrested or bearing legal responsibilities due to their capacity. Everyone, including journalists, should abide by the law," the statement said.
The bureau added that any attempt to undermine the SAR's prosperity and stability by slandering its rule of law and freedoms would be futile, and that law enforcement agencies would continue to enforce laws without fear or favour to safeguard national security and social order.