A series of car bombs exploded across Iraq's capital Saturday night, killing at least 52 people in a day of violence that saw militants storm a university in the country's restive Anbar province and take dozens hostage, authorities said.

The attacks in Baghdad largely focused on Shiite neighborhoods, underscoring the sectarian violence now striking at Iraq years after a similar wave nearly tore the country apart following the U.S.-led invasion that toppled Saddam Hussein.

Now with U.S. troops gone, Iraq finds itself fighting on fronts across the country, as separate clashes in a northern city killed 21 police officers and 38 militants, officials said.

The first Baghdad attack took place Saturday night in the capital's western Baiyaa district, killing nine people and wounding 22, police said. Later on, seven car bombs in different parts of Baghdad killed at least 41 people and wounded 62, police said. A roadside bomb in western Baghdad also killed two people and wounded six, police said. All the attacks happened in a one-hour period and largely targeted commercial streets in Shiite neighborhoods, authorities said.

Hospital officials confirmed the casualty figures. All officials spoke on condition of anonymity because they were not authorized to release details to journalists.

The Baghdad blasts came as armed fighters late Friday stormed a university in Iraq's restive Anbar province, briefly taking students hostage before withdrawing from the school amid gunfire, officials and witnesses said.

The identity of the assailants was not confirmed, but Ramadi is one of two cities in Anbar that were overrun at the start of the year by Sunni armed groups, including the Islamic State in Iraq and the Levant (ISIL). The Al-Qaeda splinter group, fighting in Syria with other rebels trying to topple President Bashar al-Assad, is also known for massive and bloody attacks in Iraq, often targeting Shiites whom they view as heretics.

The number of hostages held was not immediately clear, with some sources saying there were hundreds and others reporting dozens.

Almost 480,000 people have been forced to leave their homes in Anbar province over the past six months, according to the United Nations, in what is Iraq's largest displacement since the sectarian bloodletting that peaked in 2006-07.

Violence is still well below those levels, but armed groups have been regaining ground and momentum over the past year, making 2013 Iraq's deadliest year since security began to improve. Nearly 800 people were killed across the country in May alone – the highest monthly toll this year so far.

Sources in a Ramadi hospital said they had received the bodies of two people, one a student and the other a policeman.

Ahmed al-Mehamdi, a student at Anbar University who was taken hostage, said he awoke to the crackle of gunfire, looked out the window and saw armed men dressed in black racing across the campus. Minutes later, the gunmen entered the dormitory and ordered everyone to stay in their rooms while taking others away, he said. The Shia students at the school were terrified, al-Mehamdi said, as the gunmen identified themselves as belonging to the ISIL.

The group did not immediately claim the attack on the school, which says it has more than 10,000 students, making it one of the country's largest.

A professor trapped inside the physics department said some staff who live outside Ramadi had been spending the night at the university because it was the exam period.

"We heard intense gunfire at about 4 a.m. We thought it was the security forces coming to protect us but were surprised to see they were gunmen," he told Reuters. "They forced us to go inside the rooms and now we cannot leave."

He was later able to escape along with 15 colleagues and pupils.

"I brought some of my students' exam papers in a nylon bag and, wearing my tie and suit, jumped the fence and am outside now," he said.

Al Jazeera and wire services