He was one of the most respected and powerful men in the British Army but, when he died, he turned out to be a woman from Cork.
A report with the startling facts leaked out in July 1865 after the death of Dr James Barry, Inspector General of Hospitals -- the highest medical rank in the British Army. It emerged that he was a woman and possibly even a mother.
London society was rocked by the news, but the army refused to comment. Meanwhile, Barry had already been buried, so no post-mortem had taken place and his secret went to the grave.
In a way, it was a fitting end to the doctor's life -- he died as he had lived, surrounded by controversy.
A strict vegetarian, Barry was an outspoken, ambitious doctor of small stature and immense energy, a champion of the sick and marginalised. He blazed an illustrious medical career which, sadly, was eclipsed by the ensuing scandal surrounding his gender.
The earliest known record of the man who would become Dr James Barry is the registration of the student at Edinburgh University in 1809. He gave his place of birth as London, but his story begins in Cork city.
Barry was born Margaret Ann Bulkley in Cork in 1879. She had one brother and one sister. Little is known of the younger sister.
In 1804, when Margaret was 15, her father Jeremiah was sent to the debtors' prison. He faced bankruptcy after the marriage of her brother, John, and Margaret and her mother Mary Ann faced destitution.
Mary Ann had four brothers, one of whom lived in London. His name was James Barry, and he was an artist and a member of the Royal Academy. Mary Ann had not seen her brother for almost 30 years but wrote to him for help.
She and her daughter Margaret moved to London in around 1804.
While he did not have money, James Barry RA did have a loyal and influential circle of liberal-minded friends. And so began the education of young Margaret Bulkley. Her main tutor became Dr Edward Fryer, a medical doctor and academic.
Another friend, General Francisco Miranda, a Venezuelan soldier and scholar, had a house in London with a famously extensive library of more than 6,000 volumes, which he willingly made available to Margaret.
David Stuart Erskine, 11th Earl of Buchan, an avid supporter of the education of women, was also part of the inner circle.
It is not clear when the idea of Margaret going to medical school was mooted, but one theory suggests that it may have been General Miranda's idea, as part of his vision for the future of Venezuela.
When she graduated, she could then join General Miranda in Venezuela. And so, in November 1809, Margaret Bulkley disappeared into her London home. A few days later, the dashing, if slightly effeminate, young James Miranda Stuart Barry emerged. He left London immediately.
At Edinburgh University, the failure rate was high and James Barry was one of only about 20pc of students who graduated. He was then accepted for a limited and highly competitive apprenticeship at Guy's and St Thomas's Hospital in London, and in 1813 he applied to join the army medical board.
This was a particularly risky thing to do, but Barry's plan to move to Venezuela would have to wait, as General Miranda had been captured by the Spanish and was in prison in Cadiz. Barry was recruited to the Army medical service in 1813 and posted to Plymouth.