(CNN) Thousands of student protesters have taken to the streets of Indonesia to oppose a controversial draft criminal code that would make consensual sex outside of marriage illegal and a new law that could weaken anti-corruption efforts.

On Tuesday -- the second consecutive day of mass demonstrations in the capital -- protesters gathered outside the parliament building in the country's capital Jakarta to demand the government withdraw the draft code. Pictures from the rally show large crowds of mostly young protesters setting bonfires on the street and waving banners.

An estimated 18,000 police were dispatched to guard the Parliament Building, state media reported. Police later fired tear gas and deployed water cannons to disperse the crowds.

University students across the country staged similar protests. In the province of South Sulawesi, demonstrations became chaotic as police fired tear gas and beat students with clubs, according to state media.

Student protesters throw stones at riot police as a gate burns in the background during a protest outside the parliament in Jakarta, Indonesia, on September 24, 2019.

The proposed penal code, if passed, would usher in a raft of sweeping new laws. In addition to effectively outlawing same-sex relations, and penalties for insulting the president, the law would also impose a possible jail sentence for anyone who helped a woman terminate her pregnancy.

Read More