Thailand's three southernmost regions are emerging from a curfew that was imposed after violent clashes left six people dead.
At least 1,500 men clashed with police during the protest
Police fired water cannon and tear gas to disperse at least 1,500 protesters gathered in Narathiwat province.
The incident was one of the most serious to have taken place in Thailand's troubled south in months.
The men had gathered at a police station to protest against the detention of six Muslim men.
More than 350 people have died this year in clashes between militants and security forces in Thailand's Muslim-majority southern provinces.
Despite the curfew, that was due to end at 0600 local time (2300GMT), Reuters new agency reports that during the night, protesters set fire to a school building and burned tyres on major roads.
During the earlier clashes, Thai television showed footage of soldiers in riot gear firing M-16 automatic rifles.
Police said the protesters also used weapons, and one witness told Reuters that pistol shots came from the crowd.
At least 30 people, including 14 police officers, were wounded in the fracas, which lasted several hours.
Reuters reported that Southern Army Commander Pisan Wattanwonngkeree told Channel 9 television that more than 1,000 people had been detained following the clashes.
"I decided to stop the demonstration by firing water and tear
gas against them because I could not allow the violence to happen," Mr Wattanwonngkeree told the same network, according to AFP news agency.
The protesters had gathered at the district police station in Takbai, in Narathiwat province to protest against the detention of six men accused of providing weapons to Islamic militants.
But Sommai Puthakul, the chief of the station, told the Associated Press that he did not know why they had chosen there because the detainees were being held in the provincial capital and not in Takbai.
Thai Prime Minister Thaksin Shinawatra has flown to the south for an emergency visit.
"I want to tell the Thai Muslims... that I know about everything that goes on in the south, and I will absolutely not allow the authorities to harass the public," he told reporters.
"But when the authorities set up laws, they have to be respected," he added.
Muslims in the south have long complained of discrimination, and civil servants and security officers have been targeted in a wave of violence which began in January this year.
Muslim separatists fought a low-key insurgency in the region in the 1970s and 80s.