On the 27th of November 1835, a crowd of people gathered outside Newgate prison in the City of London to watch the first hanging there in two years.

Two men were hanged for “the abominable crime of buggery” and became the last men in Britain executed for homosexuality.

James Pratt, aged 30, was a horse-groomer, who lived in Deptford, London with his wife and children.

John Smith, 40, was from Southwark. Some reports say he was an unmarried labourer, though others sources state he was married and worked as a servant.

On an afternoon in late August 1835, Pratt met Smith, and a man called William Bonill in a pub in Blackfriars.

The three men returned to Bonill’s room that he rented in Southwark, from landlords George and Jane Berkshire.

They had no way of knowing that by that night they would all be arrested. In three months two of them would be dead.

Mr Berkshire later claimed that Bonill had frequent male visitors, and that his suspicion was aroused when he saw the three men enter the room together.

In the hope of finding a reason to evict Bonill, who he and his wife thought of as an “old villain”, George spied on the men through the window from an adjacent building.

Mr Berkshire roused his wife, and both looked through the keyhole and where they said they witnessed Pratt and Smith engaging in sexual acts.

They fetched a policeman and all three men were arrested there and then.

The magistrate who committed the three men to trial called them “degraded creatures”.

They were also told that “in this country mercy could not be expected of men like them”.

The men’s conviction rested entirely on the Berkshires’ story. Neither James Pratt or John Smith were allowed to give evidence at their trial.

A number of people came forward to testify as character witnesses to Pratt’s good character, though none spoke on the behalf of Smith.

Both pleaded “not guilty” to the charge, nevertheless the jury returned a guilty verdict.

Related: More than a billion people are still living under British anti-gay laws

Reporting at the time said that the evidence at the time was “so conclusive, that not the least shadow of doubt remained of their guilt”, though modern commentators view the Berkshires’ testimony as weak.

Whether they were really guilty or not remains a mystery to this day.

Either way, Pratt and Smith were convicted under the Offences against the Person Act 1828 and sentenced to death. Bonill was convicted of accessory and sentenced to 14 years transportation to Australia.

He was one of 290 prisoners on the ship Asia, which arrived in Van Diemen’s Land (now called Tasmania) in February 1936. He died in a hospital there six years later.

While they were imprisoned in Newgate, Pratt and Smith were visited by Charles Dickens, who was told by the jailer that the two were “dead men”.

Dickens wrote about the two men in his Sketches by Boz, saying they “had nothing to expect from the mercy of the crown, their doom was sealed”.

Pratt and Smith are buried in a common grave, with others executed at Newgate, in the City Cemetery, Manor Park, London E12.



Related: This is what the Turing Law pardon means

In the period from 1810 to 1835, 46 people convicted of sodomy were hanged and 32 sentenced to death but reprieved. A further 716 were imprisoned or received lesser sentences, such as public shaming and abuse.

On July 27, 1967, the Sexual Offences Act gained Royal Assent, partially decriminalising homosexuality in England and Wales. Further moves to equality came with the Sexual Offences Act 2003.

It is estimated that anywhere between 50,000 and 100,000 men were convicted under discriminatory anti-gay laws between 1885 and 2003.

In January 2017, Pratt and Smith were among the many posthumously affected by “Turing’s Law”, which pardoned those who had been convicted of offences under criminalised homosexuality.

“This is significant. And it’s as important to the whole lesbian, gay, bi and trans community, as it is for the gay and bi men affected,” a Stonewall spokesperson said at the time.

“The more equality is enshrined into our law books, the stronger our equality becomes, and the stronger we as a community become.”