Sex and drugs and rock and roll may have been a phrase introduced into the world by the late Ian Dury in the post-punk 1970s, but such hedonistic excesses have been around for centuries.

Back in the 1600s, for instance, Restoration poet and one of King Charles II's court, John Wilmot, aka the Second Earl Of Rochester, took full advantage of the era's post-puritan anything goes aesthetic to become the ultimate libertine. Rochester's penchant for self-destructive behaviour saw him dead at 33 of venereal disease.

All of this features in The Libertine, Stephen Jeffreys' flamboyant drama made famous a decade ago in a film starring Johnny Depp, which receives its first UK production in two decades at the Citizens Theatre, Glasgow, next week. Given the Citz's own colourful history with decadent period romps, this seems a fitting liaison.

"Rochester was a celebrity of the day," says Jeffreys. "He was like a rock star, and because London at the time was relatively small, you could cause quite a splash just leaving your house and going for a cup of coffee.

"But what annoyed Rochester was that he could not be the King. He could not be number one. So he found all these ways to draw attention to himself. Here was this man possessed with every possible talent, but who decides to waste them as a statement on the meaninglessness of life. Rochester lived this excessive life even as he hated it. In a way, romantic love, and how it can consume you so completely, was his downfall."

The roots of The Libertine date to 1975, when Jeffreys' dentist was off-loading the more adult areas of his book-shelf to patients so as not to lead his increasingly curious 13-year-old daughter astray. Jeffreys was gifted a copy of Rochester's tellingly named play, Sodom.

"I don't think I had heard of Rochester then," says Jeffreys, "but it was a green Olympia Press edition of what turned out to be what is probably the filthiest play in the English language."

It was 17 years later, while working as literary associate at the Royal Court Theatre under then artistic director Max Stafford-Clark, that Jeffreys had the notion to dramatise Rochester's life, and only then after another writer had shown an interest.

What ended up as The Libertine was eventually produced in 1994 by Stafford-Clark's Out Of Joint company in a double bill with an actual 17th century play, George Etherege's The Man Of Mode.

"At the time, the 17th century seemed more real to me than life under John Major," Jeffrey says. "I had got very bored with all these grim naturalistic plays, and had already written a play called The Clink, which was about the death of Elizabeth I. That opened in London the week Margaret Thatcher resigned as Prime Minister, so seemed to say something about life in 1990s Britain."

Jeffreys was not alone in his move away from naturalism. When The Libertine was first seen at the Royal Court, Sarah Kane's debut play, Blasted, was causing a furore in the venue's upstairs theatre. Both, in different ways, announced how drama, like the world, was changing.

"It was Christmas, and there was snow on the ground," Jeffreys recalls, "and I remember looking out of a window from the theatre, and on one side, Harold Pinter was walking towards the theatre, and on the other side Edward Bond was doing the same. At first I thought they were coming to see my play, then I realised they were coming to see Sarah's. But they were both kind of scandalous plays. Both were explosive in their own way."

While contemporary parallels with Rochester are rife, in terms of the seriousness with which he took his own self-destruction, latter-day poet wastrels such as Pete Doherty do not come close.

"It is interesting that some of the more recent casualties of a self-destructive lifestyle are female," says Jeffreys. "Amy Winehouse, she was a Rochester figure, in that she was supremely talented. But with Rochester there was an entire philosophy behind how he behaved, which is far more interesting than someone who just takes lots of drugs for the hell of it."

Historical figures have played a big part in Jeffreys' work, dating to his early days writing a version of Carmen for the Edinburgh-based Communicado company in 1984. Jeffreys had been working with Pocket Theatre company at the Brewery Arts Centre, Kendal, with actors Rob Pickavance, Alison Peebles and Gerry Mulgrew when the idea to found Communicado came up. It was his mother, according to Jeffreys, who came up with the name for a company that has used history in similar ways to himself.

"There was a point," Jeffreys says, "when I was better known as a writer in Scotland than England."

Since Carmen, Jeffreys has penned a version of 17th century comedy, A Jovial Crew, and, for Out Of Joint, a new version of John Gay's The Beggar's Opera, reimagined as The Convict's Opera.

More recently, Jeffreys co-wrote a stage adaptation of Iain Softley's 1994 John Lennon bio-pic, Backbeat, an earlier version of which had originally premiered at the Citizens. Jeffreys also wrote the screenplay of Diana, which cast Naomi Watts as the doomed people's princess.

"In a way I would rather not do it," Jeffreys admits, "and just write something purely fictional instead. What you do, I suppose, if you are putting real events in your work, is finding out what happened, then changing it. With John Lennon, you have got this whole life in the spotlight with the Beatles, and with Diana, you have got a great deal of biographical information, but you have to get beyond all that and find out about something you do not know about. You don't want to rehearse well-known facts."

While Rochester is not a household name, Jeffreys has given his subject the kind of immortality he craved.

"It's about waste," he says of the play, "and deliberately wasting a talent. I never knew that when I started writing it, but it is a very sexy play as well, very theatrical.

"It is like the difference between getting a box of fireworks and looking at the label that says how much they explode, then watching them launch themselves into the air and see what happens. That is when things become really exciting."

The Libertine, Citizens Theatre, Glasgow, May 3-24