Lady Mary’s brush with scandal in season 1 of “Downton Abbey” is based on actual events according to series creator Julian Fellowes.

Lady Mary (Michelle Dockery) was enjoying a brief-but-steamy romance with Turkish diplomat Kemal Pamuk (Theo James) only to have her paramour wind up dead while in a compromising position, namely, Lady Mary’s bed. With a dead man in her bed and her reputation on the verge of tatters, Lady Mary enlists her lady’s maid (Joanne Froggatt), and her mother, the Countess of Grantham, Cora Crawley (Elizabeth McGovern) to help her carry Pamuk back to his own bedroom so it could appear he died in his sleep, all alone.

Speaking in episode 1 of the new “Downton Abbey” rewatch podcast, Fellowes says the idea was lifted out of the tale a friend once told him. His friend, who owns a country house in England, discovered a diary written by his great-great aunt in the house dating back to the 1890s which described the impropriety in detail.

READ MORE: ‘Downton Abbey’ Stars Michelle Dockery And Michael Fox Sign Record Deal

“When Mary pulls her mother in and says Mr. Pamuk is dead, that was a real story,” he says. “In an English country house, there had been a house party. It was a little earlier [than ‘Downton’ is set], it was in 1890, and this house was unusual in that it had one gallery of bedrooms only for single women.”

Adding houses at the time had “bachelor corridors” for single men to move about undetected, it was rare for houses of ladies.

“One day, one of them [the ladies] was sleeping. She’d had a flirtation with a man at the house party and he was in her bed and he died — he had a heart attack,” he explains. “She sat there for a bit with this dead body. Finally, she got up and knocked on the door of the woman next door.”

Much like what transpires in “Downton Abbey”, the ladies moved the body back to his own room during the night.

READ MORE: The Crawleys Head To France In New Trailer For ‘Downton Abbey: A New Era’

“This woman [next door] who was a blameless matron, she knew that if this story got out, they would all be tarred by it, it would be all-round London by Monday,” Fellowes continues. “So they woke the women up along the corridor and carried this dead body through one of England’s great houses to get him back into his real bed.”

The next day, the man was discovered dead in his own bed by his valet. Lady Mary may not have escaped rumours and innuendo on “Downton Abbey”, but the real-life death appears to have remained a secret until the diaries were discovered.

“My friend who owned the house looked up his great-great grandfather’s diary and it said, ‘Very sad, this morning Mr. Turton was discovered dead in his bed by his valet. We are all so sorry.’ He was never told. It never got out,” he concluded.

“Downton Abbey: A New Era” arrives in theatres on May 20.