At 11pm on 6 December 1876, policemen patrolling the Champs-Élysées discovered a well-to-do bourgeois in a public toilet, engaged in what they described as “indecent exposure” with an 18-year-old labourer. The older man, it turned out, was the prominent Catholic politician Eugène de Germiny, a bastion of the reactionary right who railed against the government’s secular tendencies and advocated a society based on family, religion and a return to monarchy.

The press immediately called out Germiny’s double standards. Despite his protests – he claimed his adventure was merely “research” – he became a magnet for satire, his political opponents making much of his hypocrisy. The writer Gustav Flaubert described the scandal as a “comfort that encourages the will to live”. Germiny was sent to jail and went into exile on release.

‘Ubiquitous sight’ … a urinal at Place de l’Ambigu, Paris, 1875. Photograph: The State Library of Victoria

The police logbook detailing Germiny’s arrest is just one of dozens of exhibits that make up a small but fascinating exhibition exploring the secret history of Paris’s public urinals. Curated by photographer Marc Martin, it delivers an extraordinary account of sanitation, censure and sex that has remained largely untold until now. Visually, it’s gripping enough, from the image of Edgar Degas striding out of a pissotière to an overhead street shot by Brassai, and a picture by Henri Cartier-Bresson of US writer Charles Henri Ford zipping himself up. But more than anything, this show is remarkable for the story it tells.

We begin in the early 19th century, when Paris was as notorious for its noxious odours as it was revolutionary upheaval. The streets overflowed with rubbish and horse dung, and anyone caught short in the open simply relieved themselves where they stood. To remedy this, city prefect Rambuteau ordered the construction of colonnes vespasiennes – phallic-looking structures with inbuilt plumbing that allowed Paris’s male population to urinate with relative dignity. Unfortunately, there was no such luck for the rest of the population: though the notion of building conveniences for women was briefly entertained, it was decided they would take up too much space on public thoroughfares. It would be more than a century before Parisian women were granted any such “luxury”.

Despite ignoring the needs of half of Paris’s inhabitants, Rambuteau’s rudimentary urinals soon took on more complex architectural form, with the vespasienne (or tasse, in the era’s argot, meaning “cup”) eventually evolving into a structure resembling a tank turret. The design, a full-scale example of which is included in the exhibition, subsequently became a ubiquitous sight on Parisian boulevards.

The primary function of the urinals, however, was soon subverted by other needs. The relative privacy accorded by the prefabricated confines of the pissotières provided a previously non-existent space for Paris’s marginalised population of homosexual men, presenting a haven in which they could engage in acts that would otherwise have seen them locked up. Indeed, as early as 1862, the city’s policemen were recording the existence of glory holes.

Men only … a vespasienne urinal in the 1960s. Photograph: Collection Marc Martin

A morality crusade against these “dens of vice” ensued. Surveillance – of the sort in Germiny’s story – was commonplace, and conservative commentators condemned public urinals as a stain on the city. “These Parisian vespasiennes are the exact equivalent of a chamber pot left uncovered in the sitting room,” thundered one newspaper, while another complained of the “debauchery that takes place in the capital’s urinals”.

Regardless of the backlash, the tasses proved impossible to police. Ever more esoteric subcultures sprung up around them: in one instance, we see a dictionary of toilet graffiti compiled by a sociologist; and a particularly eyebrow-raising section examining the so-called soupeurs, a term applied to individuals who enjoyed dipping stale bread in other people’s urine and binge-eating the results.

The vespasiennes’ finest hour came during the German occupation of 1940-44, when the assault on freedom suddenly made the illicit encounters in public toilets seem relatively innocuous. “Under the Occupation, the streets were empty, but the pissotières were full,” recounted Roger Peyrefitte. Indeed, French, German and American soldiers would flock to the urinals to satisfy their needs. And, quite apart from sexuality, they served as important meeting places for résistants to exchange information on enemy troop movements.

‘Phallic’ … plan for an original pissoir. Photograph: Collection Marc Martin

Despite their Nazi-fighting credentials, the postwar era saw the vespasiennes condemned to history. From 1960 onwards, they were gradually dismantled on the dubious pretext of low public usage. Only one – outside La Santé prison – remains. An afterlife of sorts existed in their terminal years: one vitrine here recounts the story of a madame pipi, or lavatory attendant, who rented out cubicles for rencontres homosexuels in 1988. But the glory days were over, and with them went an entire subculture.

It’s a sad ending to a show that demonstrates how these most humble, yet crucial, facets of urban infrastructure have had lasting effects on history. Even the grottiest of stories, it seems, can be epic in scale.

• Marc Martin: Les Tasses is at Le Point Éphémère, Paris 75010, until 5 December, then travelling to the Leslie Lohman Museum in New York.