Elsewhere, Iraqis have been left to face the brutality of the militants. In Baghdad, at least eight car bombs exploded within an hour on Saturday evening, striking commercial districts in mostly Shiite neighborhoods.

And in Mosul, Iraq’s second-largest city, officials at the morgue said that the death toll after three days of fighting between militants and the government’s security forces was approaching nearly 200 people. Dozens of families have been displaced by the fighting as the militants have tightened their hold on at least three neighborhoods, witnesses said.

In Ramadi, a professor at Anbar University said that at 6:45 a.m. on Saturday, he heard explosions as the militants stormed the campus. “It was intense shelling from everywhere,” he said. The impact shattered windows in the science building, injuring one of his students. Outside, the professor said, he saw about 50 militants.

As he and other professors and students left, the militants chastised him for not waiting to make sure that female students had been evacuated, he said.

Officials said that the militants had taken hostages, but witnesses disputed that account. “They didn’t stop anyone,” said the professor, who requested anonymity to avoid antagonizing any of the fighters. “Their goal was to evacuate the university. I believe they want the buildings as a base.”

The professor and others in his group escaped the campus through a hole in the wall surrounding the university. Others fled in their cars or buses. People without transportation — including families who had been sheltering at the university after being displaced from earlier fighting in Falluja or Ramadi — were forced to wait out the siege.

By about 3 p.m., government forces had surrounded the university. A local commander of tribal forces loyal to the government said that the militants had withdrawn from most of the campus and were holed up in the science building. “The goal was not to hold the university,” said Rafa’a el-Fahdawi, the commander, citing the relatively small number of militant fighters, compared with other recent attacks. “It was to terrify people.”