Those released emerged from prison with shaved heads and some of them accused police of beating and torturing them.

Dozens of students who were arrested during anti-government protests in Nicaragua have been released by police, after days of demonstrations in which nearly 30 were killed.

Police said in a statement that detainees had been handed over to relatives and in some cases religious committees in six cities in Nicaragua by Tuesday 8:30am (14:30 GMT), but did not specify how many were let go.

The alleged protesters emerged from prison with shaved heads and some of them accused police of beating and torturing them while in captivity.

“It was three hours of torture: beatings, kicks, they lined up to kick me,” one of the students, who did not want his name publicised, told Nicaraguan newspaper La Prensa.

Also on Tuesday, the Roman Catholic Church agreed to mediate between members of civil society and Nicaragua’s embattled President Daniel Ortega.

In a press conference, cardinal Leopoldo Brenes called on Nicaraguans, as well as the goverment to “avoid all acts of violence, [and acts that are] disrespectful of public and private property”.

Protests erupted in Nicaragua on Wednesday over a controversial reform of the country’s social security system.

Police were criticised for their heavy-handed response to the protests, and accused of using live ammunition against demonstrators. Hundreds were injured, while dozens of shops in Managua were looted amid the unrest.

In a televised meeting on Sunday evening, Ortega cancelled the reforms, but tens of thousands of people marched in Managua on Monday, with many calling for the resignation of their 72-year-old president.

The former Sandinista guerrilla is on his third consecutive term and has been accused of nepotism – his wife Rosario Murillo is the vice president – and for undermining democratic institutions to tighten his grip on power.

Murillo softened her rhetoric on Tuesday when she told protesters there was “faith that we are going to go forward united”, days after coining them “vampires”.

World leaders have expressed their concern over the violent protests.

A spokesperson for the United Nations Human Rights Office called for an investigation into the deaths that occurred during the demonstrations.

“We are particularly concerned that a number of these deaths may amount to unlawful killings,” Liz Throssell told reporters at a Tuesday press briefing.

The United States condemned “the repugnant political violence by police and pro-government thugs against the people of Nicaragua” in a statement issued by the White House on Tuesday.