Few songs have marked a shift in pop music history like “The Ballad of John and Yoko.” Released by the Beatles in May 1969, the hit single — written by John Lennon and Paul McCartney, but recorded without George Harrison and Ringo Starr — features lead singer Lennon chronicling the events surrounding his wedding to Yoko Ono 50 years ago today, March 20, 1969.

“Peter Brown called to say, ‘You can make it OK, you can get married in Gibraltar near Spain,’ ” sings Lennon, referring to the personal assistant who served as best man at the wedding after the couple’s two previous attempts to get married had failed.

With the bride wearing a white minidress and floppy hat, and the groom sporting a white jacket and off-white corduroy pants, the wedding took place just eight days after McCartney married Linda Eastman in London. No less than the Rock of Gibraltar symbolized the foundation of the Lennon-Ono union.

But in many ways, their nuptials also represented the end of the Beatles, who would ultimately break up in 1970, shortly before releasing their final studio album, “Let It Be.” A cultural turning point, the wedding also signaled a more experimental artistic direction for Lennon, a growing political activism marked by the Bed-In for Peace, which the newlyweds staged on their honeymoon — and, eventually, a new life as a New York couple.

After getting hitched, Lennon even officially added “Ono” as one of his middle names. “Which kind of says, ‘We are one. John and Yoko are one,’ ” says veteran New York radio personality Dennis Elsas, who famously interviewed Lennon for WNEW-FM in 1974 and now co-hosts “The Fab Forum” on SiriusXM’s The Beatles Channel.

‘He gave credit to Yoko for much of what went on in the second part of his life and his career. It’s a wonderful love story.’

“And he would continue to make that message known throughout most of his career. He saw it as a partnership … He gave credit to Yoko for much of what went on in the second part of his life and his career. It’s a wonderful love story.”

Indeed, Elsas says that Lennon found a “kindred spirit” in the avant-garde artist, whom he met on Nov. 9, 1966, at her show in a London gallery.

The prevailing account is that Lennon, while experiencing part of the exhibit, climbed up a ladder to the ceiling and used a magnifying glass to see a tiny word: “Yes.”

Lennon would later say that if the word had been “No,” his impression of Ono wouldn’t have been nearly so positive.

At the time, he was still married to his first wife, Cynthia Lennon, but by 1968, he was posing nude with Ono on the cover of their first collaborative album, “Unfinished Music No. 1: Two Virgins.” Another joint LP, 1969’s “Wedding Album” — which will be reissued on Friday — featured them calling each other’s names over the sound of their heartbeats and used one of their wedding-day photos on the cover.

The lovebirds had initially hoped to say their “I do’s” days earlier on the cross-channel ferry from Southampton, England, to France, but Ono didn’t have the proper visa — and it turned out the captain couldn’t marry them anyway. Afterward, they flew to Paris to wed there, but they were thwarted once again because two weeks’ residency was required.

Finally, Lennon and Ono chartered a plane to Gibraltar, a British colony, and went straight to the British Consulate Office to get married. Registrar Cecil Wheeler presided over the 10-minute, hastily arranged ceremony.

The idea for the Bed-In came about because Lennon and Ono knew that it would be tough for them to have any normal romantic getaway for their honeymoon. “The more they thought of remote islands or some castle on a hill … they realized that the press — particularly the English press — would go out of their way to find them,” says Bob Gruen, the rock ’n’ roll shutterbug who photographed both Lennon and Ono in the ’70s and became a trusted friend of the couple.

So they decided to use the opportunity to promote peace by inviting the press into their suite at the Amsterdam Hilton Hotel, with signs saying, “Hair Peace” and “Bed Peace” hanging above the pajama-clad newlyweds. “I think that both of them were brilliant at getting their message out to the media,” says Elsas. “That’s how they used the Bed-In — they knew that the world’s attention would be focused on them.”

And in the midst of all that, Lennon, inspired by the series of events leading up to and during the Bed-In, found time to write “The Ballad of John and Yoko” on his honeymoon.

But the popular notion that Ono broke up the Beatles is largely misguided. “The Beatles have said so themselves,” says Gruen. “The Beatles broke up the Beatles.

“Their manager [Brian Epstein] had died, they were beginning to drift into different kinds of music, and didn’t feel the need to work together to make more Beatles music.”

Although Ono annoyed the other Beatles by showing up to their recording sessions and even offering her suggestions, Gruen says, “John was not the kind of person who could be controlled, told what to do. He did what he wanted to do. If he was with Yoko every day, that’s because he wanted to be.

“A lot of the hatred towards Yoko is absolutely racist,” adds Gruen, noting that the Japanese-born Ono wasn’t the “beautiful Swedish blonde” that other rock stars of the era might have chosen. “It was only 20 years after the second World War, when the entire world had been convinced to hate all Japanese people. And she was not only Japanese, she was odd, she had her own ideas. She was an outspoken woman who was doing unusual art that many people didn’t understand … The English press was really brutal. They said things like, ‘She was ugly.’ ”

The harsh treatment from the British press largely prompted Lennon and Ono to relocate from London to New York City in 1971. “They made the conscious decision to leave England,” says Elsas. “I mean, that was huge.”

The peace-loving pair — who, later in 1971, protested the Vietnam War on their single “Happy Xmas (War Is Over)” — first lived at the St. Regis Hotel in Midtown.

Then they moved to an apartment at 105 Bank St., which they rented from the Lovin’ Spoonful’s Joe Butler.

“They lived literally around the corner from me in Greenwich Village,” Gruen says. “John liked the idea of being in New York and not being hounded by the English press, being able to take a walk. When they lived in Greenwich Village, they rented bicycles and they went for rides around the block. I’ve gone for walks with them out on the pier … on the Hudson River. They felt very comfortable in New York. People would recognize them, but they would leave them alone.”

But Lennon and Ono, who would eventually settle at the Dakota across from Central Park, weren’t always hitting the town like other celebrities. “They lived in New York, but it’s not like John was partying at Studio 54,” says Elsas. “They weren’t necessarily scene-makers … showing up at all these parties.”

As for what their life might have been like today if Lennon hadn’t been murdered by Mark David Chapman in 1980, Elsas points to one of his final songs, “Grow Old with Me,” on which the Beatles legend expressed his eternal devotion to Ono: “Grow old along with me/Two branches of one tree/Face the setting sun/When the day is done.”