When a “frail” Ozzy Osbourne took the stage for his final Black Sabbath show, he knew the end was coming.

“If you have got to go — I mean, I wish Ozzy lived another 30 years — but if you’ve got to go out, it really felt like he knew,” rocker Tom Morello recently said on Chicago’s Q101 radio show, calling the Prince of Darkness “one of the all-time greats.”

Morello — who worked as musical director for Osbourne’s “Back to the Beginning” farewell concert in England on July 5 — marveled over “the fact that he lived to play and feel that love and to one more time; you know, to do ‘Paranoid;’ to do ‘Crazy Train.’”

The Audioslave and Rage Against the Machine guitarist, 61, also noted that “on the day, a million things could have gone wrong, and maybe like three things did. But it felt like a spiritually great moment for all fans of rock and roll.”

Ozzy Osbourne was aware his time was limited when he took the stage for his final concert, said his friend Tom Morello. Instagram/@sharonosbourne

“If you’ve got to go out, it really felt like he knew,” Morello said during a recent radio interview. Instagram/@sharonosbourne

Morello said though Osbourne had been “frail,” his death was still “terrible” news. Tom Morello/Instagram

Though Morello said Osbourne seemingly knew the end was coming, news of the artist’s death was nonetheless “terrible” news.

Osbourne “had been frail for a while, but friends of mine saw him a week later,” he said.

And though he labeled the rocker’s death a “tragedy,” Morello added that it was “a miracle” that the icon “lived as long as he did.”

Morello, who planned to make the concert “the greatest day in the history of heavy metal,” added, “Ozzy Osbourne’s lived a pretty on-the-edge lifestyle for a long time.”

The Rage Against the Machine guitarist planned to make the concert “the greatest day in the history of heavy metal.” Tom Morello/Instagram

The concert organizer said Osbourne’s final show “felt like a spiritually great moment for all fans of rock and roll.” Contour RA

Want more celebrity and pop culture news?

Start your day with Page Six Daily.

Thanks for signing up!

The metal hitmaker died on July 22 at the age of 76. “It is with more sadness than mere words can convey that we have to report that our beloved Ozzy Osbourne has passed away this morning,” read a statement from his family obtained by Page Six at the time.

“He was with his family and surrounded by love. We ask everyone to respect our family privacy at this time. Sharon, Jack, Kelly, Aimee and Louis.”

Osbourne’s legendary band paid tribute to their late frontman via Instagram, writing alongside a photo of him performing, “Ozzy Forever.”

The reality TV and rock star left behind wife Sharon Osbourne, 72, and their three children, Aimee, 41, Kelly, 40, and Jack, 39.

The Prince of Darkness died July 22 at the age of 76. Getty Images

A source told Page Six in July that the metal god’s final show “energized” him and “filled him with life.” Instagram/@sharonosbourne

“It’s a beautiful ending,” Osbourne’s longtime friend told us. Michael Ochs Archives

The Black Sabbath lead singer — who had battled Parkinson’s disease and the debilitating effects of a biking injury in his final years — was also survived by three children from his previous marriage to Thelma Riley.

He had adopted Elliot Kingsley, Riley’s son from a prior relationship, and welcomed biological kids Jessica Osbourne and Louis Osbourne with his ex-wife.

A source told Page Six in July that the metal god’s final show “energized” him and “filled him with life” in the days leading up to his passing.

“He’d really been slowing down, and then after the show he was really back to being himself,” a longtime friend told us. “It’s a beautiful ending.”