John the Painter: Britain's First International Terroristby Jessica Warner 224pp, Profile, £15.99

"I wanted to be famous," declared the young man who detonated three nail bombs in London to devastating effect in 1999, which is ironic because almost nobody can remember his name. A similar fate befell John the Painter, who frequently boasted that people "might expect to see his name made public in a remarkable manner"; and indeed, as Jessica Warner tells us in this engrossing study, "for the briefest of moments, he cheated obscurity and was the most famous man in England". But few knew his real name and even his nickname (which he hated) was quickly forgotten.

Human beings don't agree about much, but there is agreement throughout most cultures that arson is a grubby, cowardly crime. "Of all bad characters, an incendiary is the foulest," opined the General Evening Post in January 1777, responding to John the Painter's handiwork. "He acts as an assassin armed with the most dreadful of mischiefs, and in executing his diabolical purposes, involves the innocent and the guilty in the same ruin." Arson is a mini declaration of war against a whole community, which is why the cherished symbols of schools, churches, mosques and synagogues are so often targets. For John the Painter it was also a means of achieving fame, as Chaucer understood in The House of Fame with regard to Herostratus, who "for to gette of Fames hire, / The temple [of Diana at Ephesus] sette y al afire"; and indeed, John the Painter's more educated contemporaries compared him to Herostratus.

James Aitken (aka John the Painter) "was destined to be ignored while alive, and forgotten once dead", says Warner, but he "was determined not to let that happen to him. If someone had stopped to ask him what he was rebelling against, he would have said obscurity." She is clearly sympathetic to Aitken as a representative type of an intelligent working man: "A man whose ambitions and intellectual curiosity vastly exceeded his social horizons ... if he was to transcend his class and his destiny, he would need to be more than just smart: he would need to be very lucky."

Born in Edinburgh's impoverished Cowgate district, Aitken had a strong Scottish accent and a stammer. When his father suddenly dropped dead, young James was admitted to George Heriot's Hospital, where, unlike his slum peers, he learned to read and write and developed a passion for books. Unfortunately, he was not picked to go on to Edinburgh University and the system spat him out again at 14, when he was apprenticed to a lowly house painter. It was a harsh fall from grace, back into a world of poverty and humiliation, and he greatly resented it. But his little learning did not go to waste. He used it to terrorise the nation.

It remains a mystery why Aitken suddenly embraced the cause of American independence (his one visit to America was not a success), but around 1775, when he overheard someone declare that the Navy depended on the royal dockyards and that without them the war was as good as lost, he instantly knew what to do: he would burn down the dockyards, the Americans would win the war and he would return to America a hero. Aitken formed no close attachments and made no friends, and there can be little doubt that his lonely, erratic, itinerant lifestyle, drinking heavily and reading Voltaire, sent him a little crazy. On a brief trip to Paris in 1776, he met the new American Congress's representative in France, who recalled that Aitken's eyes were given to "rolling wildly".

In Portsmouth Aitken set fire to the dockyard ropehouse and in Bristol he torched three mer chantmen, some homes and warehouses. Nobody died, but as Warner says, "the real damage was psychological". Eventually it was noted that a housepainter called "John" was always skulking about prior to another inferno and the hunt for "John the Painter" began. Less than a week after a massive reward was offered for information leading to his arrest, he was in custody, having surrendered without a struggle, despite being armed. When he was pronounced guilty at his trial, the 24-year-old merely smiled.

He was hanged on March 10 1777, from the mizzenmast of a ship in the Portsmouth dockyard. It was the highest gallows ever erected in Britain and 20,000 people came to see him swing. In exchange for his life story, an unscrupulous hack promised to spare Aitken's corpse the indignity of being gibbeted, but his dead body still ended up in a gibbet above the entrance to Portsmouth harbour. Some years later it was removed and is said to be in a pub in Gosport.

Somehow Warner has turned this utterly dispiriting tale into one of resilient good humour and dogged endeavour, so that Aitken's death strikes us as deeply regrettable, despite his utter disrespect for human life. However, the real pleasure of this book comes from Warner's lively and fluid style. It is a mark of her considerable skill as a historian that she can even draw on literary sources to fill in the gaps in Aitken's story. Take this quotation from Jude the Obscure : "He was a young workman ... and in passing him they did not even see him, or hear him, rather they saw through him as through a pane of glass at their familiars beyond." It perfectly supports her observation that the very unremarkableness Aitken fought to overcome was in fact his greatest asset as a terrorist.

John the Painter's trial was immediately eclipsed by that of William Dodd, the king's chaplain, for forgery. Then came the battles of Saratoga and the terrible possibility that the "ungrateful children" of America might actually win the war. And what did the Americans make of this young man who lay down his life for American independence? They completely ignored him.