Karla Perez was kept on life support for 54 days so her unborn baby would survive.

A brain dead Nebraska woman has been kept on life support for nearly eight weeks in the hope of bringing her baby to term.

Karla Perez was 22 weeks pregnant when she collapsed after complaining of severe headaches. She never regained consciousness.

With her baby too young to survive outside of the womb, Ms Perez’s 100-strong team of doctors and nurses kept the 22-year-old mother alive on life support for a total of 54 days. It was just long enough to deliver her baby by cesarean section.

Ms Perez’s baby, named Angel, was born on April 4.

“Karla was at home, noticed she had a headache and needed to lay down and take a nap. She woke up later that evening around 10:30 or 11 and noticed the headache had become progressively worse and told her family she needed to go to the hospital,” one doctor told TV station TV station WOTV.

Doctors first thought Perez had suffered a stroke but doctors later determined that the cause of her headaches was in fact a brain bleed.

“At 22 weeks a baby can’t survive outside of the uterus or outside of the womb and so if we were going to give baby Angel any chance of survival we were going to have to prolong Karla’s pregnancy as long as possible with the minimum being possibly 24 weeks,” the doctor said.

22-year-old Karla Perez. Image via Twitter @LindseyMastis.

According to NBC, Sue Korth, vice president of Methodist Women’s Hospital said, “Our team took a giant leap of faith.”

Got some spare time?: Karisa Bugal saved her baby’s life and died during childbirth.

She added, “We were attempting something that not many before us have been able to do.”

Despite doctors hope to sustain Ms Perez long enough to deliver her baby at 32 weeks, Ms Perez’s condition deteriorated greatly just two weeks before this time.

Angel Perez’s miracle birth comes 54 days after his mother suffered a brain bleed. Image via Twitter @IndyUSA.

“Angel’s first cry was bittersweet,” the hospital said in a statement.

Angel is now in an incubator and feeding through a tube. However, on Thursday, neonatologist Dr. Brady Kerr revealed that the hospital is “cautiously optimistic”.

Following this, on April 9 Ms Perez’s liver, two kidneys and heart were delivered to donors.

What an amazing legacy this mother has left behind.