Jamie Lynn Spears wrote a touching song for her daughter Maddie -- Listen!



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 above.

16 PHOTOS
Jamie Lynn Spears and daughter Maddie Aldridge
See Gallery
Jamie Lynn Spears and daughter Maddie Aldridge
LAKE BUENA VISTA, FL - AUGUST 14: In this handout photo provided by Disney Parks, actress and country music artist Jamie Lynn Spears poses with her six-year-old daughter Maddie and Minnie Mouse in front of Cinderella Castle at the Magic Kingdom park August 14, 2014 in Lake Buena Vista, Florida. Spears, the sister of pop superstar Britney Spears and former star of 'Zoey 101' on Nickelodeon, lives in Nashville, Tenn. and is currently on tour to support her first country music single. Her sister Britney launched her career at Walt Disney World, starring in 'The All-New Mickey Mouse Club' that taped at Disney's Hollywood Studios theme park. (Photo by Chloe Rice/Disney Parks via Getty Images)
LAS VEGAS, NV - MAY 22: (L-R) Actress Jamie Lynn Spears, Maddie Briann Aldridge, and Lynne Spears in the audience at the 2016 Billboard Music Awards at T-Mobile Arena on May 22, 2016 in Las Vegas, Nevada. (Photo by Jeff Kravitz/BBMA2016/FilmMagic)
LAKE BUENA VISTA, FL - AUGUST 14: In this handout photo provided by Disney Parks, actress and country music artist Jamie Lynn Spears poses with her husband, Jamie Watson, her six-year-old daughter Maddie and Minnie Mouse in front of Cinderella Castle at the Magic Kingdom park August 14, 2014 in Lake Buena Vista, Florida. Spears, the sister of pop superstar Britney Spears and former star of 'Zoey 101' on Nickelodeon, lives in Nashville, Tenn. and is currently on tour to support her first country music single. Her sister Britney launched her career at Walt Disney World, starring in 'The All-New Mickey Mouse Club' that taped at Disney's Hollywood Studios theme park. (Photo by Chloe Rice/Disney Parks via Getty Images)
LAS VEGAS, NV - MAY 22: (L-R) Actress Jamie Lynn Spears, Maddie Briann Aldridge, and Lynne Spears attend the 2016 Billboard Music Awards at T-Mobile Arena on May 22, 2016 in Las Vegas, Nevada. (Photo by Todd Williamson/BBMA2016/Getty Images for dcp)
#TBT to all the Christmas fun we had last weekend🎄🎁🎅🏼🎄🎁🎅🏼
Somewhere in a duck blind 💛💚
Happy Thanksgiving from my "perfect" family to yours 🦃❤️🦃❤️🦃 #greentea #duckrobe #wedontpose #toofulltofunction
Church💒Lunch🍣Family🙏🏻
Another wonderful fair performance🎪Proud of our girl❤️
Thanks for the goodies @loewshotels 💙 y'all always make us feel right at home💙 #Loews #nashville
Aside from being this little girls mother, tonight was one of the biggest honors I could have ever dreamed of!! Thank you to @nsaiofficial and thank you to my wonderful co-writers, Connie and Tim❤️❤️#Nashville
Million Reasons- Lady Gaga
#Sleepover my new single available now on iTunes 💙💤💙💤 Snapchat 👻: jlspearswatson
#churchselfie 🙏🏻
Happy Father's Day to the best Dad that any girl could ask for❤️👨‍👩‍👧 We love you❤️❤️
HIDE CAPTION
SHOW CAPTION
of
SEE ALL
BACK TO SLIDE
Read Full Story

Sign up for Entertainment Insider by AOL to get the hottest pop culture news delivered straight to your inbox!

Subscribe to our other newsletters

Emails may offer personalized content or ads. Learn more. You may unsubscribe any time.