KARACHI • His father was assassinated by a notorious Karachi hitman, while his police partner was murdered by the Taleban.
Personal tragedy haunts the hard-boiled novels that are turning top cop Omar Shahid Hamid into one of Pakistan's most popular English-language authors.
For nearly two decades, Mr Hamid has worn a badge in Karachi, the mega port city on the Arabian Sea that for years was rife with vicious political and extremist violence. Now a deputy inspector-general, he is also fast becoming one of Pakistan's most recognisable writers, publishing four books in quick succession since 2013.
His work has even nabbed the attention of major streaming outlets on the hunt for new original material from South Asia, including Netflix, which has already seen major success with similar material in TV series such as Sacred Games, about Mumbai's corrupt underworld.
Mr Hamid said the secret to his success is his unflinching accounts of political corruption, contract killers and crooked cops, alongside nuanced portraits of Karachi's divided neighbourhoods.
"Books like mine wouldn't work if I pulled punches," he told Agence France-Presse. "It's that grittiness, that uncompromising reality that I think a lot of readers enjoy."
At times, the reality has hit dangerously and heartbreakingly close to home. Mr Hamid did the bulk of his writing while he was on sabbatical after being advised to leave Karachi and take a break from policing in 2011 when he was threatened by militant groups.
Weeks after the release of his first novel The Prisoner, his mentor and police partner Chaudhry Aslam - the inspiration for one of the book's protagonists - was killed in a Taleban-claimed suicide blast.
In his third novel The Party Worker, Mr Hamid portrays the rise of a brutal hitman who killed at the behest of a fictional political party ruling the city with an iron fist.
For Karachi insiders, the character mirrors the life of feared hitman Saulat Mirza, who served as the feared enforcer for the once-powerful Muttahida Qaumi Movement party - and whose list of victims include Mr Hamid's own father Shahid.
"It's less a thing of making a sketch of Saulat Mirza," said Mr Hamid, calling the character a "sketch of a particular type of young man... who kind of in the last 30 years or so essentially gave their lives away to these ideologies thinking they were doing the right thing".
The goal is not to excuse such actions, he said. "Understanding the motivations of someone is a positive tool if you're someone who has worked as an investigator in counter-terrorism for a very long time."
Said Mr Faheem Siddiqui, Karachi bureau chief for Geo News: "What he has written is fiction but it's very close to reality." Mr Siddiqui added: "As a crime reporter, I know what had happened in the city. It took a great deal of courage to write about these events."
Mr Hamid's plots go beyond his own losses to appear at times like thinly disguised retellings of the seismic moments that have rattled Karachi in the past 30 years - from the murder of American journalist Daniel Pearl in 2002 to the killing of former prime minister Benazir Bhutto's brother Murtaza.
Once a quiet port nestled on the Arabian Sea coastline, Karachi was transformed by the flood of refugees from neighbouring India after partition in 1947, setting the stage for disputes that needle the metropolis to this day.
Years later, the port became a conduit for weapons, narcotics and a new flood of refugees from war-torn Afghanistan, transforming politics and ratcheting up violence to make Karachi one of Asia's most dangerous cities.
"The last 30 years have been a roller-coaster ride," said Mr Hamid. "If it wasn't politico-ethnic violence, it was sectarian violence in Karachi that lead to jihadist terrorism."
Writing, he said, was a release. "I had a lot of frustrations about things that had happened in my career until that point," said Mr Hamid.
The themes he explores may surprise those looking for screeds to lionise the police and demonise its enemies, with stories of extrajudicial killings and corrupt officials frequently appearing. Though he often takes aim at Karachi's dangerous and powerful, he has received little blowback, he said.
But he said his latest novel The Fix, released last month, may ruffle more feathers as he explored corruption in cricket. "For a nation of cricket fanatics and conspiracy theorists, it's strangely been an area that has never really been explored," he added.
For all his explorations of Karachi's darkest corners, Mr Hamid remains hopeful for his beloved home, while admitting that the sweltering, overflowing city may seem like "an absolute hellhole" to outsiders. "It may not be everyone's cup of tea," he shrugged. "But as a city, it will keep going."