Irish singer-songwriter Niall Horan nearly missed his chance to be in One Direction, Simon Cowell has revealed.

Horan auditioned in Dublin for "The X Factor UK," where Cowell was a judge on the panel in 2010. The native of Mullingar, Co Westmeath was only 16 at the time.

Cowell, speaking to NBC Insider’s Tara Bennett at a recent red carpet event, revealed that he had to persuade one of his fellow judges to put Horan through, although he refused to name the judge.

“I had to persuade that person to put Niall through,” said Cowell. “Talk about how your life can change.”

He added: “They weren’t having it.”

Cowell said he remembered Horan's audition “very well.”

Horan came onstage hoping to perform an acapella version of Usher’s “U Got It Bad.” However, the judges preferred he sang a less challenging song with a track, all settling on Ne-Yo’s “So Sick.” 

Guest judge and superstar Katy Perry called Horan “adorable,” but thought he needed some work.

“Sometimes, you just have to learn more,” she told him. “And you’re almost there.”

Irish music manager and "X Factor UK" judge Louis Walsh said: “Niall, I think you have something, I think people would absolutely like you because you’re likable.”

But British singer Cheryl Cole said she didn't think he should move on to the next round, even though she found him "charming."

Walsh and Cowell wanted to advance the teen, leaving the final choice to Perry.

“Can I just say that I agree with Cheryl — you do need more experience, and by the way, likable-ness is not gonna sell records,” she said. “It’s talent, and you have a seed of it.”

After pressure from the live audience, Perry let Horan into the next round.

You can watch Niall Horan's "X Factor UK" audition here:

Horan has credited Perry for his career, according to the Independent. In February, the singer shared the couch with Perry's husband Orlando Bloom on "The Late Late Show with James Cordon."

He revealed: “Katy just... kept me in the competition and if it wasn’t for her I definitely would not be here and she knows it!”

Happy birthday to the loveliest lady @katyperry . have a good day , love you ! 😍😘 pic.twitter.com/KDVghwUfxO

— Niall Horan (@NiallOfficial) October 25, 2017

Through "The X Factor UK," Horan teamed up with fellow teens Harry Styles, Louis Tomlinson, Zayn Malik, and Liam Payne to form One Direction.

Although the band only placed third in the competition, the group sold over 80 million records and won multiple awards.

One Direction in Dublin in 2011. (RollingNews.ie)

One Direction in Dublin in 2011. (RollingNews.ie)

In 2017, Horan released his 2017 debut solo album "Flicker," featuring his triple-platinum song “Slow Hands.” He released his sophomore album "Heartbreak Weather" in 2020, and is due to release his newest album "The Show" in June.

Elsewhere, Horan has joined NBC's "The Voice" as a coach along with host Carson Daly and fellow coaches Blake Shelton, Kelly Clarkson, and Chance the Rapper on the 23rd season of the show.

“It’s good,” Cowell told NBC Insider of Horan joining "The Voice." “it’s just kind of a weird, full-circle-y, kind of amazing thing.”

"The Voice" airs Mondays at 8/7c on NBC, streaming the next day on Peacock.