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, he is also fast becoming one of Pakistan's most recognisable writers, publishing four books in quick succession since 2013.
Police officer Chaudry Aslam (L) escorts Saulat Mirza (C), a suspect in the murder of six US nationals and numerous killings. AFP
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 he was on sabbatical after being advised to leave Karachi and take a break from policing in 2011 when he was threatened by jihadist groups.
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."
Faheem Siddiqui gestures as he speaks during the interview about Omar Shahid Hamid. AFP
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.
Dangerous city
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 rollercoaster ride," explains Hamid.
"If wasn't politico-ethnic violence it was sectarian violence in Karachi that lead to 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."
A police officer inspects the bullet-riddled car of Shahid Hamid, managing director of KESC, who was killed by gunmen in Karachi. AFP
The themes Hamid explores may surprise those looking for screeds to lionize 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."
Agence France-Presse