The members of Deep Purple were watching their chance at making a new album go up in flames – literally. The heavy metal pioneers had come to Montreux, Switzerland in December 1971 to record their next LP with the help of the Rolling Stones Mobile Studio.

Deep Purple’s plan was to cut new tracks in the theater of the Montreux Casino, which shut down for refurbishment for a few months every winter. Claude Nobs, who founded the legendary Montreux Jazz Festival and also promoted local rock gigs, had arranged everything. The band would have access to the facilities after the season’s final concert, by Frank Zappa and the Mothers of Invention. But “some stupid with a flare gun” altered rock history.

“At the end of the concert someone threw a flare gun at the ceiling and everything started to be on fire,” the late Nobs told Gibson in 2010. “Frank Zappa took his guitar – a Gibson, a very strong one – and he smashed the big window down with his guitar. Then a lot of people could go out through there. … And the people were watching the fire thinking, ‘Oh, you know, Frank Zappa is just doing an incredible ending to his show’.”

Meanwhile, Deep Purple, who had evacuated the show, returned to their hotel and watched the casino burn down. Fortunately, no lives were lost. Even the Stones’ mobile truck (which had been parked next to the casino) was spared when it was driven to safety. Although Deep Purple didn’t have a place to record, they had one hell of a story.

Although part of his livelihood was in rubble, Nobs took care of Deep Purple, finding the band alternate recording locations. They started off at another theater in Montreux, Le Pavilion, where guitarist Ritchie Blackmore would record one of the most famous riffs in rock history. The crunching instrumental (at this point) didn’t have lyrics or even a name, but it was thunderous enough to annoy nearby residents, who called the police on the band. Nobs then moved Deep Purple to the derelict Grand Hotel, on the edge of town.

With no one living close by, the quintet could make all the noise they wanted. And it was while working at the Grand Hotel that bassist Roger Glover and Ian Gillan gave shape to Deep Purple’s legendary song.

“I woke up one morning in the hotel and, you know that kinda half-asleep, half-awake state? You haven’t opened your eyes yet, but you’re kinda half-awake. I said the words out loud, ‘Smoke on the Water,'” Glover recalled, years later. “I have no idea if it came from a dream or from the image of the smoke hanging over the lake [on the day of the casino fire]. Whatever it was, those words kind of hit me.”

Listen to Deep Purple's "Smoke on the Water'

With a title in place, frontman Gillan began to write autobiographical lyrics about what had happened when Deep Purple arrived in Montreux. The words referenced the city, the fire, Zappa and “Funky Claude” who helped kids out of the burning building, as well as how the band eventually recorded what would become the Machine Head album.

Before completing “Smoke on the Water,” Deep Purple had recorded a bunch of material, including “Pictures of Home” and its buzzing Jon Lord keyboard solo, “Space Truckin’” featuring Ian Paice’s pounding rhythm and “Highway Star” which the band had already been playing live. Glover, Blackmore and Gillian wrote the driving opener on a bus in ’71, after a journalist asked them about Deep Purple’s songwriting process.

“And I suppose it started out as a bit of a joke. Ritchie got a guitar and started playing and Ian started warbling about cars and I came up with the title,” Glover told The Quietus. “I was looking out of the window thinking, ‘Well, here we are on the highway... Highway Star!’ You know? And it just got thrown together and in fact I think we performed it that night, a sort of embryonic version of it. Most great songs you hardly have to work on.”

However, when it came to record the song for Machine Head, Blackmore took a little extra care with his guitar solo, which was partially inspired by Bach’s classical works. Although the guitarist usually took an improvisational approach to his solos during sessions, “Highway Star” was a little different.

“That was one of the only solos that I worked out completely at home,” Blackmore told Guitar Player. “Most of my solos were improv-ed on the spot, but that one was arranged before I went into the studio.”

After finishing recording in late 1971, Deep Purple released Machine Head on March 25, 1972. The band’s sixth LP went immediately to No. 1 in the U.K. and remained on the charts for weeks, aided by singles including “Never Before,” “Lazy” and “Highway Star.” Machine Head was more of a slow burn in the United States, partially because “Smoke on the Water” wasn’t released as a single until May 1973.

The song became Purple’s most successful U.S. single (hitting No. 4 on Billboard, as did 1968’s “Hush”) and pushed its parent album to No. 7. In all, Machine Head spent more than two years on the American charts, as Deep Purple become hard rock heavyweights known around the world. Decades later, it remains the band’s biggest album.

Rock Hall's Worst Band Member Snubs

When the group gets inducted into the Rock & Roll Hall of Fame without you.

Jon Lord and Ian Paice Were in One of Rock’s Forgotten Supergroups

More From Ultimate Classic Rock