Pavel expressed his "great sadness" and "anger at the completely unnecessary loss" of lives.
The shooting began at around 15:00 local time (14:00 GMT) on Thursday at the Charles University Faculty of Arts building near Jan Palach Square in the center of the Czech capital.
The gunman opened fire in the corridors and classrooms of the building, killing at random, while staff and students used furniture to barricade themselves in the rooms, writes the BBC, KosovaPress reports.
A video shows crowds of terrified people fleeing the city's historic Charles Bridge, a major tourist attraction.
Inside the building, student Jakob Weizman used chairs and tables to barricade the classroom door where he was with a teacher when the shooting began.
Shortly after blocking it, Weizman said he heard someone trying to open the door. "He was going through every classroom to see if people were there to shoot them," he told the Guardian newspaper.
Eventually Weziman and the teacher were evacuated by the police. "As we were walking out, there was just blood all over the faculty," he said.
American tourist Hannah Mallicoat told the BBC that she and her family had been in Jan Palach Square during the attack.
"A crowd of people were crossing the street when they heard the first shots. I thought it was something like a firework until I heard the second shot and people started running," she said.
"I saw a bullet hit the ground on the other side of the square about 9 meters away before I entered a shop. The whole area was blocked off and dozens of police cars and ambulances were heading towards the university."
Joe Hyland, 18, from the UK, told the BBC he heard four shots.
"Everybody was running for cover. I've got a hurt knee, I'm on crutches. So I jumped as fast as I could," added Hyland, who was on his first holiday with friends . "We got to the subway and got off there because we thought it would be the safest."
Police say the gunman was a 24-year-old university student and had no previous criminal record, although they say a "large arsenal of weapons and ammunition" was found.
He has been named by local media as David Kozak.
Before the shooting, police had received a report that the suspect was believed to be traveling to Prague from a nearby town with the intention of killing himself.
Officers evacuated another university building where the gunman was expected to attend a lecture, but were called to the nearby main faculty building a short time later.
The gunman, who police said had been "eliminated", is believed to have killed his father elsewhere.
Police said they had unconfirmed information from a social media account that the attack was inspired by a similar incident in Russia, although they did not provide further details.
They said the gunman was also suspected of killing a young man and his two-month-old daughter, who were found dead in a forest on the outskirts of Prague on December 15.
Of the 25 people injured in the shooting, 10 were seriously injured, police said, adding that no officers were injured.