* At least 21 protesters arrested
* King leaves palace to greet thousands of supporters
* Major demonstration planned for Wednesday
Hundreds of Thai protesters scuffled with police and threw blue paint at them on Tuesday and, after 21 of them were arrested, chanted "release our friends!" as the royal motorcade of King Maha Vajiralongkorn swept past.
Among those taken away were Jatupat Boonpattararaksa, a protest leader, and Chaiamorn Kaewwiboonpan, a singer. People who were detained would be charged appropriately, police said.
"The protesters may not have observed the law today so police had to act to bring order and didn't act disproportionately," government spokesperson Anucha Burapachai told Reuters.
Such open dissent towards the monarchy has no recent precedent in Thailand, and came on the eve of the latest planned anti-government demonstrations.
The protests, which have persisted for three months, present the biggest challenge in years to a political establishment dominated by the army and the palace.
Protesters are calling for a new constitution and the removal of Prime Minister Prayuth Chan-ocha, a former junta leader.
They have also called for curbs on the powers of the monarchy, breaking a longstanding taboo against criticising the royal family which many people still revere.
The Royal Palace has given no response to requests for comment on the protests or demands for royal reform.
In a sign of the monarch's ongoing popularity among many Thais, the king and queen left the palace late on Tuesday, smiling broadly as they greeted thousands of cheering supporters who waited in the rain on the anniversary of his father's death.
Earlier in the day, hours before the royal motorcade was due to pass Bangkok's Democracy Monument, protesters had pushed up against a police line and some threw blue paint.
Police demolished a tent set up for the protest and dragged some demonstrators into police vehicles.
After the trouble, the royal motorcade passed by on the other side of the street. Protesters raised their hands in the three-fingered salute of anti-government campaigners and demanded the release of those detained.
"This is the ugliness of feudalism, where one person can do anything and the majority of the people have to accept it unconditionally," Parit "Penguin" Chirawat, a student leader, said on Twitter.
The top trending hashtag on the social media platform in Thailand, used more than 1.5 million times, insulted the king.
Insults to the monarchy are punishable by up to 15 years in prison under Thailand's lese majeste laws, but the prime minister said earlier this year that the king requested that they not be used for now.
Protesters have said they do not seek the abolition of the monarchy, but to reduce the king's powers under the constitution and to reverse an order to put the palace fortune and some army units under his control.
"The monarchy has to be under the constitution, that is how it supposed to be," said 21-year-old protester Waranya Siripanya.
In the evening, the demonstrators moved to the police station where the detainees were being held, pressing against the gates to demand their release.
Tuesday was a public holiday to mark four years since the death of the king's widely respected father, King Bhumibol Adulyadej, who reigned for seven decades.
Vajiralongkorn, who spends much of his time in Germany, made a rare visit to Thailand for the occasion.
Thousands of royalists gathered to pay their respects, bearing the late king's picture and flowers and wearing yellow shirts, the colour associated with him.
Many royalists were critical of the protesters.
"They may have been taught and told that the monarchy doesn't have any value to the nation," said Narongsak Poomsisa-ard, 67. "But I want to remind them that our nation exists until today, because we have the strong institution."
Thailand's King Maha Vajiralongkorn and Queen Suthida greet royalist supporters who gathered outside the Grand Palace to mark the 4th year anniversary of late King Bhumibol Adulyadej's death, in Bangkok, Thailand