Police in Ireland arrested 34 people in relation to riots that swept through Dublin on Thursday, when cars and a bus were burned following a stabbing earlier in the day.

Around 500 people wreaked havoc on the streets, with about a dozen stores looted while rocks and bottles were thrown at crowd control officers equipped with helmets and shields. An empty tram train that had been left at a stop had its windows smashed and was also set on fire.

The violence began after rumors circulated that a foreign national was responsible for a stabbing outside a school on Thursday afternoon.

The suspect, who is understood to be of Algerian descent and is a naturalized Irish citizen, attacked three children with a knife outside an elementary school in the city center just after 1:30 p.m. A 5-year-old girl was seriously injured, while the two other children, a boy and a girl, suffered minor injuries.

RIOTERS CLASH WITH POLICE, TORCH CAR AFTER KNIFE ATTACK IN DUBLIN

Car burns in Dublin, Ireland amid riots

A car burns as Irish police officers stand at the scene of an attack in Dublin on Thursday Nov. 23, 2023. A 5-year-old girl is receiving emergency medical treatment in a Dublin hospital following an attack on Thursday that involved a knife. A woman and two other children were also injured. (Brian Lawless/PA via AP)

The woman, who worked at the school and cared for the children, intervened and was also stabbed and seriously injured, according to RTE.

Caio Benicio, a delivery driver who is originally from Brazil, came to their aid by using his helmet to hit the alleged suspect. Several bystanders helped restrain the perpetrator until police arrived on the scene. The suspect remains hospitalized in serious condition.

A motive for the attack is unknown, and police are understood to be ruling out terrorism.

dublin protests

Fire burns as people gather near the scene of a suspected stabbing that left three children injured in Dublin on Nov. 23, 2023. (REUTERS/Clodagh Kilcoyne)

TERROR SUSPECT ACCUSED IN TEACHER STABBING SWORE ALLEGIANCE TO ISIS BEFORE KNIFING, PROSECUTOR SAYS

Police cordoned off the area, and then protesters gathered and faced off with police. One demonstrator could be seen holding an "Irish Lives Matter" sign while others waved the Irish tricolor. Tensions then flared, and the rioting kicked off as nightfall descended on Dublin.

The unrest followed dozens of peaceful protests throughout the country by people raising safety concerns about an influx of immigrants and how they are draining state resources. 

However, Irish Justice Minister Helen McEntee said that those who rioted did not do so for immigration purposes and labeled them as "thugs" and "criminals."

"There was a protest earlier that was a general peaceful protest, but a separate group then [came] with an intention to seek and wreak havoc," McEntee said. 

Irish Prime Minister Leo Varadkar said the country’s capital had endured two attacks — one on innocent children and the other on "our society and the rule of law."

"These criminals did not do what they did because they love Ireland, they did not do what they did because they wanted to protect Irish people, they did not do it out of any sense of patriotism, however warped," Varadkar told reporters on Friday morning. 

"They did so because they’re filled with hate, they love violence, they love chaos, and they love causing pain to others."

Workers remove a burnt bus in Dublin following a night of violence

Workers remove burnt vehicles on Nov. 24, 2023, in Dublin. Vehicles were set ablaze and shops were looted in Dublin last night following a knife attack outside a school that left five people, including three children, injured. (Charles McQuillan/Getty Images)

Garda Commissioner Drew Harris, the head of Ireland’s national police force, said one officer was seriously injured in clashes with the rioters, some of whom were armed with metal bars and covered their faces.

Harris described the protesters as a "complete lunatic hooligan faction driven by far-right ideology."

More than 400 officers, including many in riot gear, were deployed throughout the city center to contain the unrest. A cordon was set up around the Irish Parliament building, Leinster House, and mounted officers were dispatched to nearby Grafton Street.

GERMAN POLICE ARREST 2 MEN ACCUSED OF SMUGGLING OVER 200 MIGRANTS INTO EUROPE

"These (riots) are scenes that we have not seen in decades, but what is clear is that people have been radicalized through social media and the internet,’’ Harris told reporters on Friday.

"But I don’t want to lose focus on the terrible event in terms of the dreadful assault on schoolchildren and their teacher,'' he said. "There’s a full investigation ongoing. There’s also a full investigation in respect on the disorder.

Workers clean up the debris of a burnt train in Dublin following riots

Workers clean up the debris of a burnt train on Nov. 24, 2023, in Dublin. Vehicles were set on fire and shops were looted in Dublin last night following a knife attack outside a school that left five people, including three children, injured. (Charles McQuillan/Getty Images)

CLICK HERE TO GET THE FOX NEWS APP

Ireland has seen an unprecedented spike in illegal migrants and asylum seekers over the last number of years, a large portion of whom have been put into temporary accommodation by the state and given welfare. It comes as the nation faces a chronic housing shortage, along with a spiraling homeless crisis and a cost of living crisis.

Furthermore, foreign nationals have been responsible for a number of high-profile serious crimes over the past few years.

For instance, Slovak man Jozef Puška was convicted earlier this month of brutally stabbing teacher Ashling Murphy as she jogged in County Offaly. 

Last month, Yousef Palani, who is of Iraqi descent, was convicted of murdering two men in an apparent anti-gay attack. One murder victim was decapitated with 43 stab wounds, and the second man was stabbed 25 times mainly to his head, neck and chest, according to court reports.

The Associated Press contributed to this report.