“What a wonder is a gun,” Stephen Sondheim wrote in “Assassins!,” a musical about the troubled souls who take potshots at presidents. ”What a versatile invention! First of all, when you’ve a gun — Everybody pays attention.”

Usually, these days, when people want attention, they do what Oscar Ramiro Ortega-Hernandez allegedly did before going to the White House: Try to get Oprah involved.

Footage recently surfaced of a tape the alleged shooter recorded, apparently to send to Oprah Winfrey. In it, he proclaims, among other things, “It is not just a coincidence that I look like Jesus. I am the modern-day Jesus Christ that you all have been waiting for.”

“So I ask you, Oprah — better yet, I’m begging you, Oprah, please ask me onto your show, Oprah. It is so crucial that the world hears God’s word, for the fate of humanity. For the fate of mankind.”

In most groups, the person with the urge to make a video proclaiming himself a modern-day Jesus and send it to Oprah stands out like a sore thumb. But there’s one group where he fits right in: the gaggle of would-be presidential assassins. Sondheim could incorporate him into the chorus of an “Assassins” revival without blinking an eye.

In fact, his offering is far from the weirdest of its kind. We remember John Hinckley Jr. and his Jodie Foster fixation. Samuel Byck, who ineptly attempted to assassinate Richard Nixon, left a slew of tape-recorded messages for celebrities including Leonard Bernstein.

It’s a peculiar subgenre of people. Villains and would-be villains always come equipped, it seems, with three names. It’s practically a convention of the genre. John Wilkes Booth. Lee Harvey Oswald. Now Oscar Ramiro Ortega-Hernandez, with his Jesus-like appearance and unhinged pronouncements, may be eligible to join the ranks.

Attention must be paid. That’s a refrain to which the Sondheim chorus keeps returning. You sense that you’re losing your audience. Leonard Bernstein keeps ignoring your recordings. Jodie doesn’t answer your letters. And so you wind up with a gun instead of a tape.

It’s certainly a way of attracting attention. But more than that, the desire to gun for the president is almost a subgenre of the American Dream. Anyone can aim for the nation’s highest office. It’s the perverse flip side of the more common idea that the president somehow has it in his power to fix everything, the notion of the magic Prosperity lever somewhere in the Oval Office that the president is contumaciously failing to press. Attempted assassination, in its way, is the highest form of flattery, motivated by the idea that, no matter who you are or what ails you, targeting the president can solve it — even if Oprah can’t.

We are lucky: Ortega-Hernandez’s alleged crime amounts fortunately to little more than shooting at a house. The president and his wife were out of town and out of danger.

But Sondheim was right about the gun. Now we’ve all seen the video.