Riz Ahmed in the HBO series "The Night Of" (Barry Wetcher/HBO)

A man wakes up, disoriented after spending the night with a woman he just met . . . and realizes that she’s covered in blood, dead from stab wounds. Soon, he’s a suspect in her murder.

That’s a tantalizing premise for a TV show, especially when it’s co-created by Steve Zaillian, known for writing acclaimed movies such as “Gangs of New York,” “Moneyball” and “Schindler’s List.” It’s also a lot of story to unpack. But when Zaillian took on HBO’s highly anticipated crime drama “The Night Of,” his first project for television, he encountered an unexpected luxury: time.

“I’m just as interested — sometimes more interested — in scenes that you don’t have to have, but are very revealing in terms of character,” said Zaillian, who co-created and co-wrote the eight-episode limited series with famed novelist Richard Price. “With a film, you really can’t get away with that.”

Zaillian’s mind-set is evident in “The Night Of,” which debuts Sunday.The show moves at a deliberate pace. The camera lingers on details that might not matter — or could become absolutely crucial. That type of precision proves absorbing, and the suspenseful series has gotten rave reviews from critics — and, possibly more important — accolades on social media. (“You should get on board for this one,” author Stephen King recently tweeted.)

It’s no secret that HBO, the longtime king of premium cable, needs another buzzworthy drama. “Game of Thrones” is still a smash success, but aging quickly. “True Detective” may never recover from that disappointing second season. “Vinyl” was just abruptly canceled after a lackluster first season. Can “The Night Of” become the network’s next Sunday night hit?

HBO is optimistic, citing “overwhelmingly positive” internal reaction to the series and solid word-of-mouth. Kary Antholis, president of HBO’s miniseries division, says that he doesn’t remember ever working on something (even standout miniseries such as “Angels in America,” "Olive Kitteridge” and “John Adams”) that had this type of “positive vibe,” even before the air date. Still, the network is measuring expectations.

“We’re not looking for the huge hit to follow up ‘Game of Thrones.’ We’re just looking to engage the audience and give them something that they’re going to want to come back to, week after week,” Antholis said, adding, “I don’t know that it’s going to have huge numbers starting off. But our hope is that the quality of it and the addictive nature of it as a television show will speak for itself.”

Years in the making

Despite the critical love now, at first it was unclear whether “The Night Of” would make it onto the screen. Adapted from the BBC miniseries “Criminal Justice,” the tale starts with a quiet, studious college student, Naz (Riz Ahmed), who lives at home with his parents in Queens. One night, he secretly borrows his father’s taxi to drive to a party in Manhattan. On the way, a young woman named Andrea (Sofia Black-D’Elia) stumbles into the back of his cab. She doesn’t care that he’s not actually a driver, and they embark on an ad­ven­ture.

After they spend a wild night together, Naz blacks out — and wakes to find Andrea stabbed to death. Fast-forward, and Naz is taken into custody. He insists he’s innocent, although it doesn’t help that he has a bloody knife in his jacket. A stunned Naz is transported to Rikers Island prison to await trial, and the series delves into the tangled and infuriating web of the criminal justice system, including racial politics; Naz is Pakistani American.

The series first landed at HBO in early 2009, when BBC Worldwide Productions President Jane Tranter approached executives about making it into an American drama. She later enlisted Zaillian to direct, and together they approached Price (who worked on HBO’s “The Wire”) to write the pilot. The project got a boost when “The Sopranos” star James Gandolfini signed on to executive produce and play Jack Stone, a haggard, low-level lawyer who gets the break of a lifetime to represent Naz. They shot the pilot in 2012.

“It takes a long time to do television — at least, it takes a long time to do it the way we did it, which was not the typical way,” Zaillian said. “We didn’t have writers’ rooms, we weren’t working and leapfrogging on episodes. We did it as one, long nine-hour movie.”

John Turturro was hired for a role that was initially meant for James Gandolfini. (Craig Blankenhorn/HBO)

Initially, HBO passed on the show as a multi-season drama, but later decided to greenlight it as a limited series. Then, only a few months later, in June 2013, Gandolfini died of a heart attack. Mourning their friend and colleague, thoseinvolved weren’t sure how to proceed or whether the series would continue.

Many months later, Zaillian and Price started writing the rest of the episodes, and eventually they recast the Gandolfini role with veteran actor John Turturro (“Quiz Show,” “O Brother, Where Art Thou?”). He and Ahmed had instant chemistry capturing the difficult attorney-client relationship, Jack is out of his league, and Naz is terrified.

The script reminded Turturro of “The Staircase,” a 2005 documentary about the trial of Michael Peterson, accused of killing his wife. Hethought “The Night Of” was a very “well-observed” take on every side of a crime.

“I liked that you dealt with not just the plot and the whodunit quality, but how the crime accusation affects everybody. The cost of it really ruins people,” Turturro said. “I don’t [normally] think people can change . . . but a terrible thing can really alter you. You don’t usually get to see that.”

Twists and turns

Zaillian, directing seven out of the eight episodes, was a stickler for authenticity as they shot all around New York City and amassedmountains of research, includinginterviews with detainees at Rikers. The show tackles all angles, with scenes featuring the lead detective (Bill Camp), the prosecutor (Jeannie Berlin), a fellow dangerous prisoner (Michael K. Williams) and Naz’s cash-strapped parents (Poorna Jagannathan and Peyman Moaadi).

“Steve was indefatigable as far as detail. There was nothing really that bored him,” Turturro said.

The series remains timely, in its addressingof the justice system’s flaws and Islamophobia. Naz is referred to as everything from “that Arab dude” to “towel head.”

John Turturro, left, and Riz Ahmed in "The Night Of." (Craig Blankenhorn/HBO)

Ahmed, a 33-year-old British actor, spent weeks in Queens, immersing himself in New York culture to get a feel for his character. He felt added pressure after he saw the real-life parallels to the tragedy of Kalief Browder, a 16-year-old accused of stealing a backpack and held at Rikers Island for three years without a trial. Although prosecutors dropped the charges and Browder went home, he never recovered from solitary confinement and committed suicide at 22.

“It felt like a big responsibility portraying that story,” Ahmed said. For prisoners, he said. “There’s something permanent about that experience . . . it’s not really something you can walk away from unscathed. It’s very often something people don’t walk away from.”

Although the series hasmany twists and turns, HBO has been careful with its marketing, not revealing too many elements and releasing only vague trailers.

“That’s very much by design. We wanted to make it feel intriguing and distinctive,” Antholis said, “like nothing else you’ve seen before.

“It’s very much organic to the notions behind the show itself: Draw you in, nothing is exactly what it appears, and yet you can’t stop watching it.”