Jamie Lynn Spears Wrote a Touching Song for Her Daughter Maddie -- Listen!

Getty Images

'When the Lights Go Out' resurfaced after Maddie was rushed to the hospital on Sunday.

Jamie Lynn Spears has always been inspired by her little girl.

A beautiful song Spears wrote for her daughter, Maddie, resurfaced after the 8-year-old was rushed to the hospital on Sunday.


WATCH: Jamie Lynn Spears' Daughter Maddie Was Submerged in Pond for 2 Minutes After ATV Crash, Police Report Says

Spears wrote "When the Lights Go Out" about the first night she spent away from Maddie, and performed the emotional song at the Grand Ole Opry in March of last year. The singer's 2016 documentary, Jamie Lynn Spears: When the Lights Go Out, was also named after the song.

"Whenever I wrote 'When the Lights Go Out,' it was coming from a place ... it was the first night, of course, that Maddie was away from me," she explained in the TLC documentary. "She was with her dad for the first time, and I was by myself."

"In that moment, I called Daddy [Jamie Spears]. I was just by myself, and I was just like, I want to be able to let people into that side of me because that's the story. That's why I'm doing it," said Spears, who split from Maddie's dad, Casey Aldridge, when Maddie was 2 years old. "As you can tell, the music moves me, of course, but it comes from moments like that."

"It reminds me of exactly why I'm still driven to do this, for this baby girl," she added. "I just want to be a good mom who makes her little girl proud."


WATCH: Jamie Lynn Spears' 8-Year-Old Daughter Maddie Reportedly 'Awake' and 'Talking' Following ATV Accident


According to a police report
obtained by ET, Maddie was rushed to the hospital on Sunday after the ATV she was riding ran into a pond. Maddie was trapped underwater for two minutes, as Spears and her husband, Jamie Watson, tried to rescue her. 

"All I can say is pray for our baby Maddie," Spears' father, Jamie, told ET shortly after the accident, while a source close to the family revealed that despite the crash, "Maddie is a great rider."

"She grew up riding ATVs just like Jamie Lynn did," the source added. "Maddie isn't a wild rider -- she is very cautious."


WATCH: Britney Spears Speaks Out on Niece Maddie's Hospitalization: 'Need All the Prayers and Wishes'

See more in the video below.