His father was assassinated by a notorious Karachi hitman, while his police partner was murdered by the Taliban.
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, 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, who is also quickly 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.
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 tells AFP.
"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.
Hamid did the bulk of his writing while on sabbatical, which was strongly advised after jihadist groups threatened him to take a break from policing and leave Karachi in 2011.
Close to reality -
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 Taliban-claimed suicide blast.
In his third novel "The Party Worker", 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 (MQM) party -- and whose list of victims include Hamid's own father, Shahid.
"It's less a thing of making a sketch of Saulat Mirza," explains 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 insists.
"Understanding the motivations of someone is a positive tool if you're someone who has worked as an investigator in counterterrorism for a very long time," says Hamid.
"What he has written is fiction, but it's very close to reality," says Faheem Siddiqui, Karachi bureau chief for Geo News.
"As a crime reporter, I know what had happened in the city. It took a great deal of courage to write about these events."
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 last 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 neighboring India after the 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 rollercoaster ride," explains Hamid.
"If wasn't politico-ethnic violence it was sectarian violence in Karachi that lead to jihadist terrorism."
Writing, he explains, was a release.
"I had a lot of frustrations about things that had happened in my career until that point," says Hamid.
"I felt a need to vent about them."
The themes Hamid explores may surprise those looking to glorify 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 admits.
But he says his latest novel "The Fix" released in June may ruffle more feathers, as he explores 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 explains.
For all his explorations of Karachi's darkest corners, Hamid remains hopeful for his beloved home, while admitting the sweltering, overflowing city may seem like "an absolute hellhole" to outsiders.
"It may not be everyone's cup of tea," he shrugs. "But as a city, it will keep going."