Kourtney Kardashian had to have "urgent fetal surgery" to save her baby's life.
The 44-year-old reality TV star - who has three children with her former partner Scott Disick - is expecting her first child with husband Travis Barker and suffered a scare last week when she was rushed into surgery.
She shared on Instagram: "I will be forever grateful to my incredible doctors for saving our baby’s life. I am eternally grateful to my husband who rushed to my side from tour to be with me in the hospital and take care of me afterwards, my rock. And to my mom, thank you for holding my hand through this.
"As someone who has had three really easy pregnancies in the past, I wasn’t prepared for the fear of rushing into urgent fetal surgery. I don’t think anyone who hasn’t been through a similar situation can begin to understand that feeling of fear. I have a whole new understanding and respect for the mamas who have had to fight for their babies while pregnant.
"Praise be to God. Walking out of the hospital with my baby boy in my tummy and safe was the truest blessing."
Travis, 47 - who shared Kourtney's post on his Instagram Stories - hinted at the medical emergency last week when he cancelled some European dates on his band Blink-182's tour and rushed back to the United States.
He also posted a picture from the prayer room at Glasgow airport hours after cancelling their UK and Ireland shows.