Composed by Mike Post, he was tasked with creating a theme song that Dick Wolf said has “got to define New York City”

It’s one of the most iconic theme songs in television’s history, and it all started in 1990 with a directive to “define New York City.”

About six hours later, the theme song for the Law & Order franchise was born.

Recently, the 35-year-old theme song began going viral after a TikTok creator made a dance to the soundtrack. That dance has now sparked a slew of online recreations, including one by Law & Order: SVU stars Mariska Hargitay and Kelli Giddish.

The origins of the song all began after series creator Dick Wolf sent a pilot script to music producer Mike Post, as the two had worked together on other shows in the past, such as Hill Street Blues. After getting the initial Law & Order script, Post asked his pal for musical direction.

“He said, ‘Basically, it’s steam coming out of the street. It’s gonna be streety on the cop side, but have majesty to it and the scales of justice. But overall, it’s got to define New York City,’ ” Post recalled on Law & Order’s YouTube. “Those were my marching orders.”

Having felt that composer George Gershwin had already done that with his 1924 piece “Rhapsody in Blue,” Post decided to use the nearly seven-decade-old work as an inspiration.

Within moments, the first keyboard riff came out, and he believed he was on to something.

“I had this new guitar and then I started messing around with that,” he said. “I started pulling strings and snapping them. All of a sudden, those two elements came together.”

For the bridge, the five-time GRAMMY winner used a clarinet to pay homage to Gershwin.

Hours later, the jazzy, gritty theme was sent to Wolf.

“Dick Wolf, he really, really liked it,” Post said. “He went, ‘Oops, that’s my show. That’s what I was hoping for.’ ”

As Post was getting ready to begin his next project, Wolf called him with another idea about dating stamping scene changes to give them more gravitas. The celebrated musician liked the idea but had no interest, reiterating that he’s a composer. He even told Wolf to “call sound effects.” Wolf wouldn’t relent, insisting that the scene change “stamp” had to be created by a pro and not something found in a sound library.

Working with fellow composer Danny Lux, Post started banging on things and making any noise he could. Finally, he came up with the iconic “dun dun” composition, also known as “The Clang,” that is now so intertwined with the drama.

“Two or three years later, [Wolf] sends me a note one day. He says, ‘Isn’t it funny after all the great music that you’ve written all anybody’s going to care about is two notes that aren’t notes?’” Post said, adding, “He was right.”

Because “The Clang” is classified as music, Post makes royalties every time it’s used.