Mohsin Hamid couldn’t have predicted what kind of political waters his new novel, “Exit West,” would drop into once it was released.

But with President Donald J. Trump’s attempt in January to ban immigrants and visitors from seven predominantly Muslim countries and all refugees, Hamid’s tale about Saeed and Nadia, two lovers trying to escape civil-war chaos in an unidentified Near Eastern metropolis, couldn’t feel more timely.

The city where Hamid’s characters live could be Aleppo or it could be Mosul. Its name is not the point. Wherever it is, it’s falling to anti-government militants, neighborhood by neighborhood. It’s also subject to bombings by government forces trying to hold their ground.

Weaponized drones fly overhead. Internet and cellphone service have evaporated. The electricity goes out. All municipal services — gas, water — have broken down.

Saeed’s mother, while searching for a lost earring in the family’s car, is killed by “a stray heavy-caliber round.” The entire city is victim to “the predations of warriors on both sides who seemed content to flatten it in order to possess it.”

To stay is to court imminent death. The closer the populace edges toward despair, the more credence they give to “endless rumors” of magical doors that help them escape this bedlam.

Those doors do indeed exist, and Saeed and Nadia work up the nerve to take advantage of them. But the destinations they reach — the Greek island of Mykonos, central London, a shantytown outside San Francisco — don’t necessarily deliver the sanctuary they imagined.

With “Exit West,” Hamid has entered the realm of speculative fiction. It would be a pleasure to report that he has mastered the genre with the same biting prowess that he brought to his satire, “How to Get Filthy Rich in Rising Asia,” and to his Man Booker Prize-nominated masterpiece, “The Reluctant Fundamentalist.” But that’s not quite the case.

“Exit West” works best in its first half, as it describes the deteriorating conditions that its characters endure. “War in Saeed and Nadia’s city,” Hamid writes, “revealed itself to be an intimate experience, combatants pressed close together, front lines defined at the level of the street one took to work, the school one’s sister attended, the house of one’s aunt’s best friend, the shop where one bought cigarettes.”

Hamid’s prose is a mix of clinical detachment and run-on-sentence urgency. In its accounts of “nativist backlash” against refugees in London, it does a lot more telling than showing. His description of building improvised refugee-camp infrastructure in the Marin Hills likewise feels more like something out of an instruction manual than lived experience.

In earlier books, Hamid was a master of streamlining and distillation. But as “Exit West” winds down, his narrative is sometimes more perfunctory than artfully spare.

Still, even in this last half, as Nadia and Saeed find their relationship tested by the desperate moves they’ve made, there are sharp observations and lyrical turns of phrase. When Saeed’s widowed father refuses to escape overseas with the couple, Nadia is stricken by the thought that “when we migrate, we murder from our lives those we left behind.” Saeed’s feeling that he and Nadia are “adrift in a world where one could go anywhere but still find nothing” speaks powerfully to the dilemma of exiles and refugees everywhere.

A final curious component of the novel is its snapshot takes of other, briefly glimpsed characters who go through other doors in unexpected directions — among them, a suicidal man who, rather than putting a knife to his wrists, takes a chance on a door that winds up leading to a beach in Namibia, and two old men, one Dutch, one Brazilian, who try out each other’s worlds for a while via a garden-shed door before settling down as lovers in Amsterdam.

Sanctuary and alternative existences, Hamid suggests, aren’t just for those fleeing war zones.

Novelist Michael Upchurch is a freelance writer.