The former Harry Potter-turned-Weird Al biopic star recalled the strange story on The Tonight Show.

Casting Daniel Radcliffe as "Weird Al" Yankovic was apparently an element-ary decision.

The former Harry Potter-turned-Weird Al biopic star stopped by The Tonight Show on Friday, where he recalled the strange story of how he got cast as the pop-music parodist, involving Rihanna and a song about the periodic table of the elements.

As Radcliffe explained, he was confused himself as to why Yankovic wanted him to play the role. "When I talked to Al for the first time, I was like, 'I'm immensely flattered by the idea that you would pick me to play you, but like, why me?'" the actor told Jimmy Fallon.

The answer goes back to November 2010, when Radcliffe sang satirist Tom Lehrer's novelty song "The Elements," which lists most of the elements of the periodic table, on The Graham Norton Show.

"I sang 'The Elements' next to Colin Farrell and a very bemused Rihanna, who I think was like, 'Who is this kid and why is he singing all of the elements?'" Radcliffe recalled. "And I guess Al saw that and was like, 'This guy maybe gets it.' And so picked me."

The resulting biopic, Weird: The Al Yankovic Story, wrapped filming earlier this month and will be released on the Roku Channel. The movie also stars Evan Rachel Wood as MadonnaRainn Wilson as California radio host Dr. Demento, and Toby Huss and Julianne Nicholson as Yankovic's parents. It's not entirely clear what the film will ultimately look like, but it seems likely that it will be a somewhat tongue-in-cheek account of Yankovic's life and career.

"I'm honored to finally share with the world the absolutely 100 percent unassailably true story of Weird Al's depraved and scandalous life," Radcliffe recently told PEOPLE.

You can see more from the actor on The Tonight Show below, and you can see him performing "The Elements" on Graham Norton above.

Related content: