Oliver Cromwell limped in 10th in BBC television's Great Britons poll. But what were the voters celebrating? A TV pundit summarised the period thus: Charles I was executed, Cromwell bored England for 10 years and then everyone was glad to get the Stuarts back. But Cromwell boring England has always interested me. Wars are glamorous; the difficult bit is what you do with the peace.

Embarking on a play about the period, I first wrote an epic treatment: the Putney Debates, Charles I's trial and termination of the Rump parliament in 1653 ("Take away that bauble... in the name of God, go!"). Yet it remained a history lesson and a pageant - and extremely expensive to stage. Was there another approach?

Cromwell was the obvious way in, but studies of leaders are unfashionable in the theatre. What about a study of Cromwell at the end of his life? I was partly influenced by Gabriel García Márquez's The General in his Labyrinth, which charts Simón Bolívar's final journey in 1830 as a way of summing up his achievements. Could I send Cromwell on a journey around battlefields and the Fens? Not very feasible on the stage.

But an incident a year before his death intrigued me. In February 1657, parliament offered him the crown. He hesitated for two months and then refused. Why did he choose not to become King Oliver? The final days of these months of uncertainty were a way of looking at the republic as a whole. I had a framework.

The more you delve into Cromwell, the more contradictory he becomes - and that makes good theatre. He came to power through the army, yet could an army set up a democracy? He insisted on free elections, but ordered his soldiers to exclude the opposition. He closed down cathedral choirs, yet loved music.

Since his death Cromwell's reputation has soared and plummeted. The Stuarts vilified him, but Pepys was soon lamenting his absence. The Victorians hailed him as a founder of parliamentary democracy, religious toleration, foreign and imperial domination. SR Gardiner called him "the national hero of the 19th century... the greatest because the most typical Englishman of all time".

Yet in the 1950s Durham University voted against naming a college after the man who had founded them. To the left, the true heroes of the revolution became the Levellers and Diggers, whom Cromwell had suppressed.

He was also regarded as the architect of the Protestant ascendancy in Ireland, the butcher of Drogheda. Cromwell's popular image became that of a puritan who smashed stained glass windows and closed theatres. The Cavaliers were charismatic romantics; the Roundheads dour killjoys.

The argument rages to this day. This newspaper has run articles comparing Cromwell to General Zia of Pakistan. Yet Muriel Zagha wrote this year that Cromwell's regime left a cultural legacy in painting, music and opera.

My play was bursting with material. But who would inhabit these contradictions? The two most likely candidates were Cromwell's son Richard and his second-in-command John Lambert. Richard didn't want the job, and Lambert leaned towards military dictatorship.

Parliament's case for kingship was to be represented by John Thurloe, his secretary of state and spymaster. Bettie, Cromwell's favourite daughter, could try to interest her father in the new opera, The Cruelty of the Spaniards in Peru.

Then I chose two outsiders. Edward Sexby, a Leveller turned assassin, was to be the voice of old, socialist truth attacking Cromwell's perceived move towards the centre. My final choice was a cheeky one. The finest political poem of the period is Andrew Marvell's Horatian Ode on Cromwell's Return from Ireland. What if Cromwell was plagued by the poem's ambiguities and interrogates Marvell about its meaning?

What about Cromwell? There are two theories about his last years: one that he was a spent force; the other that he had lost none of his questing fervour. My Cromwell is the latter; he rages to the end. He is beset by problems. Should he take the crown? Who should succeed him? What regime will best outlive him? Has his rule been a success or a failure? Is there ultimately any difference?

I did not intend to play the part myself, but few actors were free or ready to take on such a huge role for a five-week run, so I accepted my fate. Of course, the play is my interpretation of Cromwell, and I am partly writing about myself.

I realise that just as Cromwell is trying to make sense of his life, so too, on a different canvas, is the writer. I don't confuse myself with Cromwell. But as rehearsals progress, I find myself listening with unusual attention to what the other characters have to say. I am beginning to understand what I have written. That's probably the greatest gain of acting in your own play.

· King Cromwell is at the Orange Tree Theatre, Richmond, from November 12 to December 13. Box office: 020-8940 3633.