Tens of thousands of Serbians protested on Monday, demanding better security, a ban on violent TV content and the resignation of key ministers, days after two mass shootings killed 17 people.

Crowds in numbers not seen in the Balkan country for years solemnly marched through the centre of the capital Belgrade behind a banner reading "Serbia Against Violence".

"We have gathered here to pay our last respects, to do our best so this never happens again, anywhere," said Borivoje Plecevic from Belgrade.

A schoolboy who brought two handguns to his school on Wednesday killed eight pupils and a security guard. Six other pupils and a teacher were wounded.

A day later, a 21-year-old man brandishing an assault rifle and a pistol killed eight and wounded 14 people.

Both shooters surrendered to the police.

Protesters and opposition supporters demanded a shutdown of TV stations and tabloids that they accuse of promoting violent and vulgar content.

Opposition parties and some rights groups accuse President Aleksandar Vucic and his ruling populist Serbian Progressive Party (SNS) of autocracy, oppressing media freedoms, violence against political opponents, corruption and ties with organised crime. Vucic and his allies deny the accusations.

Vucic said protesters on Monday were trying to force him to step down and destabilise the country. He said he was ready to test his party's popularity in a snap vote, but did not specify the date.

"I will continue to work and I will never back down before the street and the mob....Whether it will be a reshuffle of the government or (snap) election, we shall see," he said in a live TV broadcast.

Parliamentary elections in Serbia are due in 2026 and a presidential contest in 2027.

Protesters also called for the resignations of Interior Minister Bratislav Gasic and Aleksandar Vulin, the director of the state security agency, and the dismissal of the government's Regulatory Committee for Electronic Media (REM) within a week.

Education Minister Branko Ruzic resigned on Sunday.

Demonstrators demanded an emergency parliamentary session and a debate about the overall security situation.

This is an act of "solidarity against ... violence in media, in the parliament, in everyday life ... solidarity because of lost children," said Snezana, a woman in her 60s who declined to give her last name.

Similar protests were held in several other Serbian cities.

In response to the shootings, Serbia's police on Monday started a one-month amnesty for surrendering illegal weapons. It said over 1,500 were handed over on the first day.

Vucic announced police checks of registered gun owners.

Serbia has a deeply entrenched gun culture, and along with the rest of the Western Balkans is awash with military-grade weapons and ordnance in private hands after the wars of the 1990s that tore apart the former Yugoslavia.