ERIE — Two construction workers and a school district employee were injured Wednesday following an explosion in Erie Middle School’s gymnasium that shook nearby homes and caused part of the building’s roof to collapse.

One of the victims remained in critical condition Wednesday night, one was in serious condition, and one was treated and released from a hospital.

No students or teachers were in the building at the time of the explosion, which occurred in a part of the school that is being renovated, officials said.

Investigators said they determined the explosion happened when a plumbing contractor, working on the school’s construction project, was lighting a hot water heater in the mechanical room above the gymnasium. They said it was the first time the natural gas had been turned on following the extensive remodel, according to Laura McConnell, a spokeswoman for the Mountain View Fire Protection District.

Emergency dispatchers began receiving calls at 12:13 p.m. Wednesday about the explosion at the school, 650 Main St., according to McConnell.

When emergency crews arrived, they found the explosion had caused part of the gym’s roof to collapse. The three victims suffered fall- and burn-related injuries, McConnell said, with two being transported to local hospitals by ambulance and one victim airlifted from the scene.

Officials did not release the identities of the three victims.

Late Wednesday night, McConnell said one of the victims had been upgraded from critical to serious condition. One was still critical. The third victim, who was one of the contractors on the project, was treated and released from a hospital.

Rick Ring, chief operations officer for the St. Vrain Valley School District, said one of the contractors was taken to University Hospital with first- and second-degree burns and possible internal injuries. The other was treated and released “and is doing fine,” Ring said.

While school was not in session Wednesday, McConnell said there were some school officials present who were overseeing construction inside the building. Although officials initially indicated that all three victims were contractors, John Poynton, spokesman for the district, confirmed Wednesday evening that one of them was a district employee.

Superintendent Don Haddad visited the district employee at a hospital and said the man was “coherent and talking” but had sustained broken ribs, broken vertebrae and burns.

“It’s a very difficult situation,” Haddad said. “Our thoughts and our prayers are with the individuals.”

The explosion could be heard at neighboring homes and caused several neighbors to run outside to see what was going on.

“I was just watching TV when I heard this big old boom and the pictures fell off the wall,” said Lisa Armijo, who lives a few doors down from Erie Middle School. “I just grabbed my kids and ran outside. It was pretty scary.”

Another neighbor, Mike Meade, said, “I knew it wasn’t a kid jumping around or something falling over. You could tell right away it was a pretty big explosion.”

Klipp Architecture and Adolfson & Peterson Construction have been removing the school’s second floor this summer, as the district expands the school’s capacity from 532 students to 950 students.

Of the school’s 115,000 square feet, 50,000 square feet are being renovated, while 25,000 square feet are being demolished and replaced, according to officials. Although the second floor is being removed, new classrooms will be added on the northwestern and eastern sides of the school, so it will have 26 classrooms, up from 20.

Construction began in November, while school was in session. Temporary classrooms are being used to house students as the remodeling work is done. The entire project was scheduled to be finished for the fall of 2013.

Classes are scheduled to start at Erie Middle School on Aug. 16.

The Erie Police Department, Lafayette Fire Department and the Colorado State Patrol also responded to assist Mountain View Fire and the Boulder County Sheriff’s Office at the scene Wednesday.

District officials are hoping that structural engineers can get in the school Thursday to evaluate the damage.

Camera staff writers Amy Bounds and Cory Lamz, Colorado Hometown Weekly staff writer Doug Pike and Times-Call staff writer Victoria Camron contributed to this report.

Contact Camera Staff Writer Mitchell Byars at 303-473-1329 or byarsm@dailycamera.com.