Three construction workers were seriously hurt in an explosion at a Bronx high school that was so powerful it shook neighbors' homes and startled residents, who thought they were experiencing an earthquake.

"This was a very troubling evening for residents here in Marble Hill," Mayor de Blasio said at a news conference at John F. Kennedy High School Thursday night, describing a "shocking scene."

De Blasio said the injured workers had "very serious burns" and were being treated at local hospitals.

FDNY firefighters swarmed the school after getting the call at about 8 p.m. Crews were working on a gas line when the explosion occurred on the sixth floor of the building, according to police and Con Edison, but the utility says it's determined that it was not a gas explosion.

De Blasio said authorities will be investigating to determine what caused the blast.

FDNY Commissioner Daniel Nigro said building engineers and other authorities will also be assessing the structural integrity of the building to determine if it's safe to occupy. For now, it appears, that although the building has been seriously damaged, the structural damage is limited.

The mayor said the engineers' assessment will determine whether part or all of the building can reopen in time for the new school year, set to start Sept. 9.

The workers had been privately contracted by the New York City Schools Construction Authority as part of a project to build science labs on the sixth floor of the building, the mayor said. The SCA had frequently worked with the unidentified contractor, who de Blasio said "had a great reputation."

Some custodians who were on break in the building at the time told NBC 4 New York they were just getting ready to return to work when they felt the blast.

"I thought it was a bomb, the way we felt it, it was just crazy," said Addae Hicks.

Colleague Jason Osorio said they heard the explosion, saw a quick flash, "and then the alarms went off 5 seconds after."

Neighbor Larissa Alvarado, who lives next to the school on East 228th Street, said "the whole house shook completely. I thought the whole house was going to fall down. It was really, really scary."

Another neighbor, Christina Pineles, said it felt like an earthquake. Her building was "shaking, like it was going to collapse."

Around 1,300 students in ninth through 12th grades attend JFK High School, according to the city's schools website, but de Blasio said the building actually houses eight schools with a total of 4,000 students.

Congressman Eliot L. Engel released a statement thanking first responders and the Con Edison crews that were on scene investigating.

"Our thoughts and prayers are with the three people injured in tonight's terrible accident at John F. Kennedy High School," he said in the statement. "As frightening and horrific as this explosion was, the fact that we are only a few short weeks away from students returning to the campus for the school year makes the incident even more terrifying."