If you've watched Loudwire's Gear Factor series over the years, you've no doubt seen how influential Deep Purple's "Smoke on the Water" riff is, especially for guitar players just starting out and learning to play. But that iconic riff came very close to not even making it to record, as the band was swarmed by local police just prior to getting it down in the studio.

Speaking with Classic Rock magazine, as transcribed by Guitar World, drummer Ian Paice and guitarist Ritchie Blackmore recalled how the now classic track and riff came about and the under pressure moment that led to its eventual usage by the band.

The song was recorded at the Montreaux Casino pavilion theater and ballroom when their initial recording venue of choice was set on fire. But, as the band went well into the night and there was a noise curfew in the area, their jamming was not appreciated by the locals who called the cops.

Paice recalled, “The first track we laid down – and the last to be finished – was 'Smoke on the Water,' before we knew what it was going to be called. There was no sound-proofing and we were recording at night. A hell of a racket!”

Blackmore continued, “We did 'Smoke on the Water' there, and the riff I made up in the spur of the moment. I just threw it together with Ian Paice. Roger Glover joined in. We went outside to the mobile unit and were listening back to one of the takes, and there was some hammering on the door."

As the guitarist tells it, “It was the local police, and they were trying to stop the whole thing because it was so loud. We knew that they were coming to close everything down. We said to Martin Birch, our engineer: ‘Let’s see if we have a take.’ So they were outside hammering and taking out their guns… It was getting pretty hostile."

Knowing that their session was about to get shut down, Birch says the band locked all the doors, then ran back inside to lay down the "Smoke on the Water" riff as quickly as possible before they were shut down.

READ MORE: Ritchie Blackmore Wasn't Inspired Before Final Deep Purple Exit

That turned out to not be the only barrier en route to the song's release. As Ian Gillan tells it, the song only made the album because they were short with some time to fill on the record.

“It wasn’t being considered as a track for the album,” he explained. "It was a jam at the first sound-check. We didn’t work on the arrangement – it was a jam. 'Smoke on the Water' only made it onto the album as a filler track because we were short of time. On vinyl, thirty-eight minutes – nineteen minutes per side – was the optimum time if you wanted good quality and we were about seven minutes short with one day to go. So we dug out the jam and put vocals to it.”

The song was added to Deep Purple's 1972 Machihe Head album, where it was the final single off the record nearly a year after the album's release. It rose to No. 4 on the Billboard Hot 100 chart and became an inspiration for aspiring guitar players for many years to come.

The Top 25 Best Selling Hard Rock + Metal Artists of All Time

These bands have been sold and streamed more than any other rockers. Sellouts!

More From The Quake 102.1