Tens of thousands of students and teachers have protested across Brazil against sharp cuts to education enacted by Jair Bolsonaro’s administration – the first mass protests since the far-right president took office in January.

Brazil’s National Student Union called for demonstrations after the education ministry said it was freezing up to 30% of discretionary spending due to the government’s precarious fiscal situation.

The rally in Rio de Janeiro turned violent when police fired teargas and percussion grenades and protestors set a bus on fire.

Protestors chanted “education is not a commodity” and “there will be no cuts, there will be fight” and referenced Bolsonaro’s alleged connections to paramilitary gangs.

“The government makes mayhem. Public universities make science,” read one sign, referencing a recent interview given by the education minister, Abraham Weintraub, in which he said: “Universities that instead of trying to achieve the best academic form, are just making a mayhem, will have their budgets cut.”

Speaking in Dallas, Texas, where he travelled to attend a gala dinner, Bolsonaro denied his government had cut education budgets and cast the protests as a partisan spectacle. “They are useful idiots, imbeciles, who are being used as the manoeuvring mass of a clever little minority who make up the nucleus of many federal universities in Brazil,” he said.

The cuts to the country’s education system sent shock waves through federally funded universities, generally Brazil’s most prestigious and competitive schools.

University hospitals, research grants and federally funded high schools are also affected by the cuts, which the Ministry of Education said was a part of meeting a spending cap imposed by Bolsonaro.

Students light flares as they protest against a massive cut in the education budget imposed by Jair Bolsonaro. Photograph: André Penner/AP

Called to explain the cuts to lawmakers in Congress, Weintraub blamed the situation on the legacy of the previous government, while defending a shift away from spending on universities to favour elementary schools.

“The priority is preschool, elementary school and technical school,” he said. “A scientific, technical, number-based, efficient and managerial approach is vital to save this country from the economic stagnation of the last 20 years that we are living.”

At the Federal University of Rio de Janeiro, students said conditions on campus were already dire. Letícia Ferreira, an art student, said the classroom she studied in flooded when it rained and lost electricity if they turned on a fan.

Another art student at the university, Isadora Grilo, said the cuts were aimed to “alienate everyone, so they don’t have any critical thinking.” The university said 41% of its budget was cut.

Barbara Ottero, 29, who got her bachelors and masters degrees from a federal university that will be affected by the cuts. “They will make education totally inaccessible. It’s practically privatising,” she said.

“My father was unemployed when I went to university, there was no way I could have paid. It’s unjust for students.”

A man carrying a flag with the face of Brazil’s former President Lula da Silva walks past a bus set on fire. Photograph: Ricardo Moraes/Reuters

Elizabeth Saar, a retired sociology teacher said universities were being attacked. “If we had difficulties in schools before, now public education is practically over.”

The marches marked the first national protests against the administration of Bolsonaro, whose poll numbers are falling as he struggles with a weak economy, rising unemployment, an unruly coalition in Congress and infighting in his cabinet.

The protest is the latest development in an increasingly heated battle over Brazilian education. Bolsonaro and many of his supporters have declared war over what they call “indoctrination” by left-leaning teachers in schools by instructing students to record and snitch on their teachers.

Dom Phillips contributed reporting