A middle-aged woman was seriously injured this evening after getting her leg caught between an elevator car and the shaft wall at a Brooklyn hospital.

Firefighters and Downstate SUNY Medical Center workers worked feverishly for more than an hour to free the woman – described as in her 40s — from the horrific jam on the 8th floor.

“It was a traumatic rescue,” said FDNY Dep. Chief Wayne Cartwright. “We used two jaws of life to try to push the car back enough to release the leg. When we couldn’t push it back far enough we ended up cutting a hole in the car.”

It wasn’t immediately clear whether the woman — who was drifiting in and out of consciousness and bleeding profusely during the ordeal — was a visitor, patient or employee.

Officials weren’t certain how she ended up in the elevator shaft shortly before 5 p.m.