A fire roared through a hospital before dawn Tuesday, killing at least 17 people and trapping others in a building that lacked proper fire exits, officials said.

Nurses broke out windows trying to escape, firefighters took patients down on ladders and a doctor who was in the middle of a heart procedure on a patient carried him out when he smelled smoke.

The fire, the second this year at the Calderon Guardia Hospital (search) in the capital of San Jose, broke out on the fifth floor at 2:23 a.m. EDT, Fire Chief Hector Chavez told Channel 7 Television News. It was brought under control three hours later.

At least 17 people were killed, and the death toll could rise as the search for more victims continued, Red Cross official Alexander Poras told local TV stations. Some of the patients hid under their beds to escape the fire, he said.

Survivors were being evacuated to other hospitals.

The fire originated near the hospital's central staircase, and traveled quickly to the front of the building, "which made it impossible for people to go down through there," Chavez said.

The cause of the blaze was not known.

The hospital lacked proper fire exits, he said. Firefighters and rescue workers from the Costa Rican Red Cross used ladders to evacuate people.

One of the victims was a nurse who was helping patients evacuate the fifth floor when she died of smoke inhalation. She was still holding a flashlight when her body was found, Chavez said.

Thirteen other victims also were on the fifth floor, while a 15th was on the fourth, he said. Both floors were destroyed.

"I was with my mother on the fifth floor. ... It was terrible," Luz Marina Chinchilla said between sobs. "A nurse shouted and set off the alarm." She was able to escort her mother safely out of the building.

Dr. Eduardo Saenz said he was in the middle of a heart procedure on a patient when he smelled smoke and carried the patient to safety.

Many family members rushed to the hospital to check on loved ones.

"I came to get my wife," Luis Prado said. "I went up to the second floor, but they wouldn't let me beyond that. ... But I found my wife and helped her and brought her to an ambulance."

Calderon Guardia is one of Costa Rica's main hospitals, receiving patients from all over the country.

In January, a small fire broke out in the same area of the building, but no one was injured. At that time, the hospital's fire alarms failed to work, officials said.