Our urge to scrawl on a wall has been around for pretty much as long as there have been walls around for us to scrawl on. The workmen who built the Great Pyramid of Khufu at Giza left behind scribbles that may explain how they did it. An ancient Roman scratched what is often interpreted as directions to a nearby brothel into the paving stones at Ephesus, while others were leaving declarations of love, political slogans, rude gossip and scandalous accusations all over Pompeii.

In later times, it became customary, if not obligatory, for anyone who visited ancient sites to record the fact upon them. As early as 1240BC, "Hadnakhte, scribe of the treasury" was inscribing an account of his trip: "came to make an excursion and to amuse himself on the west of the Memphis, together with his brother, Panakhti" on a temple wall at Giza. The Romans effectively saw the Great Pyramid as a giant visitor's book, and generations of European tourists, from Napoleonic soldiers to Lord Byron, left their marks across swathes of Greece, Italy and Egypt well into the 19th century.

Victorian graffiti on one of the statues at the Abu Simbel temple complex built by Rameses II. Photograph: Werner Forman/Universal Images Group Editorial

The practice was so common that during a tour of Egypt in 1850, the French novelist Gustave Flaubert expressed his great irritation, in a letter to his uncle, at "the number of imbeciles' names written everywhere", declaring himself particularly unamused by the fact that in Alexandria, "a certain Thompson, of Sunderland, has inscribed his name in letters six feet high on Pompeii's column … It can be read a quarter of a mile off. There is no way of seeing the column without seeing the name of Thompson. This imbecile has become part of the monument and is perpetuated with it."

From the mid-20th century, though, as travel writer Rolf Potts notes in an informative essay, despite the best efforts of US GIs who left "Kilroy was here" inscriptions from the Arc de Triomphe in Paris to the Marco Polo Bridge in China, the practice was widely condemned – but it still persists, even if, these days, defacing a historic monument can have hefty consequences. In Egypt, the offence carries a fine of more than $20,000 and up to 12 months in prison. In India, where the Taj Mahal and Delhi's Lodhi Gardens and Purana Qila fort have been badly affected, graffitists risk up to 1 lakh (about £970) in fines and up to two years in jail. And in Britain, a man who spray-painted slogans on Clifford's Tower and the statue of Constantine in York was recently handed a four-month prison term.

To counter the scourge, English Heritage – which reckons up to 70,000 historic sites and buildings in Britain could be damaged each year by crimes including graffiti – recommends "passive design and active management measures" such as lighting, CCTV, barriers such as shrubs or fences, and landscaping solutions such as walkways, but recognises these aren't always possible around listed buildings. Easy-clean anti-graffiti polymer coatings, widely used on modern buildings, can be problematic on the more porous materials found in many older buildings because they can slow or prevent water evaporation, leading to mould or salt crystallisation problems (although, as part of an EU-sponsored project, a German firm has now invented a promising "breathable" coating).

A detail of graffiti left on the battlements of the Great Wall of China. Photograph: Eightfish/Getty Images

Or, like China, you can set aside a whole section of one of the world's best-known ancient monuments for tourists to carve their names on. Authorities in Beijing recently designated Fighting Tower 14 of the Mutianyu section of the Great Wall a "free graffiti zone", and are considering setting up two similar areas in Fighting Towers 5 and 10. Which is decent of them, because the most recent international graffiti scandal was provoked last year by a 15-year-old from Nanjing who, much like the scribe Hadnakhte 3,500 years ago, cheerfully scratched the words "Ding Jinhao was here" on a 3,500-year-old Luxor Temple carving in Egypt. Scrawling on a – preferably ancient – wall is plainly a habit that will die hard.