Danny Boyle is up a ladder, looking down on the chaos he's created. Dust settles on what's left of a terrace house's bathroom, its plastic peach suite covered in powdered masonry and plaster from the recently demolished toilet wall. A gunman has just burst through it head-first, leaving a beige fog behind him as he runs away. Boyle's hair has little bits of plaster in it as he peers into the monitor, satisfied. "OK, got it," he says quietly and the crew start clearing up.

We are not in a terrace house but a curtained-off area in the middle of an open-plan 70s office block next to the Tower of London. Boyle, along with Peep Show writers Sam Bain and Jesse Armstrong, is tackling the damaged relationship between the police, the public and the media in Channel 4's newest cop show, Babylon, the pilot for a six-part series that starts filming in the spring. It brings together the thump-thump rhythm seemingly on constant play inside Boyle's head with the lemony-sharp dialogue of the men who helped make terrorism funny in Four Lions. Neither out-and-out comedy nor brow-furrowing drama, it makes for a heady mix.

Just weeks ago the real Metropolitan police announced a trial of personal video cameras for their firearms officers in order to "build trust with the people of London" following the killing of Mark Duggan. This is the same technique that allowed early episodes of Peep Show to provide that perfect up-nostril shot. So art and life merge. Babylon throws cameraphones, Twitter and indiscriminate violence into the mix. It barrels along with Boyle's trademark ravey energy, simultaneously urgent and confusing, as the people in charge try and fail to get a grip on the slippery truth before it wriggles free and goes viral.

James Nesbitt plays Met commissioner Richard Miller, the man theoretically in charge. Scenes filmed in his office overlook the cityscape and Nesbitt says: "I was looking out over most of London and thinking, 'Christ, this guy is responsible for everyone out there.'" He's a middle-aged suit trying to move with the times and turn around the force's image. He thinks he's found his answer in Liz Garvey. She's young, driven, a blue-sky thinker with incredible hair, and he's employed her on the strength of a TED talk (she's played by US actor and writer Brit Marling). He wants in on that freshness and radical perspective and offers her a job as his communications director, despite her lack of experience. As the snubbed communications no 2 sneers: "The commissioner saw her TED talk on 360-degree communication and his dick went hard."



Reading this on mobile? Click here to view

There are some irksome hints of Richard's attraction to her in the pilot episode, but the show has enough going for it not to need a will-they-won't-they romance. Nesbitt explains its appeal: "It's about transparency, accountability, particularly in the wake of the hacking and De Menezes scandals, but also how much you put out there and the secrets that are kept." Recent news reports on Plebgate, the hacking trials and Duggan's death depict a force in crisis and unwilling to admit mistakes. Nesbitt goes on: "When Paul Stephenson resigned, he was the first Met commissioner to resign since the commissioner that presided over the Jack the Ripper case. People have lost faith in the police and they are trying to address that."

Enter Liz, whose buzzphrase is the brilliantly abysmal "We're dumping the journalists and we're asking the public for a date instead." But her commitment to "truth" is instantly put to the test as an unfolding situation throws police and public alike into confusion.

"All truth will find its way to the surface eventually," says Marling, sounding not unlike her character, referring to the new tech landscape in which the Met is now trying to operate. "Because of Twitter, because some hostage-takers are tweeting their demands: that's a public-forum conversation now." Which begs the question: how do you hunt down perpetrators, even use deadly force, when the world is watching and commenting in real-time?

To make things worse, Liz, in the interests of transparency, has invited a documentary crew to shadow the Territorial Support Group in an effort to humanise them for the public. Excitable footsoldier Robbie quickly learns to curb his trigger-happy approach to crowd control when the cameras follow his unit to a demonstration. As he's about to land a punch on a non-conforming protester, he clocks the lens and growls, "Get back in the coach or I will verbally dominate you." The programme-makers are playing with the idea that not all officers choose the job for the right reasons, with Robbie showing an unhealthy interest in joining the Specialist Firearms Command. As you'd expect, not all the cops come out of it as dedicated, community-serving saints.

Bain and Armstrong were invited to meet Boyle and his producer Robert Jones back in 2010 when the director was about to start filming outdoors epic 127 Hours. "He acted out 127 Hours in the room with us," says Bain. "He acted out cutting off his arm and talked about the nerve, that last nerve." Bain in particular talks of his initial awe at meeting Boyle but Armstrong keeps it professional and is often the one to pull the conversation back to serious matters when his partner cracks a gag. On set they are self-contained, one of the pair always hovering behind the camera, quietly observing while Boyle politely instructs cast and crew until the image is right. Watching them work is like watching a discreet curling team, judiciously brushing the ice, occasionally muttering to one another. They admit they wouldn't naturally have been drawn to the cop show genre but the idea of doing one with Boyle's production values excited them. "It gave us the confidence to actually write the kind of material that we hadn't written before, like action and stuff involving guns," says Bain, clearly enjoying the Boy's Own fun of filming car chases and blowing stuff up.

Nick Blood as Officer Warwick, Andrew Brooke as Officer Neil and Stuart Martin as Officer Tony. Photograph: Dean Rogers

How does their writing relationship – now in its 17th year – work now they're moving into more dramatic material?

"I have all the power…" deadpans Bain.

"And I do the cleaning," adds Armstrong. They're both keen to emphasise their commitment to the comedy in everything they write. So should the police be worried that they're being satirised in the manner of The Thick Of It (Armstrong was on the writing team) or Four Lions (the pair's bold comedy with director Chris Morris about a hapless team of jihadi terrorists)? Marling doesn't think so. "Sam and Jesse and certainly Danny have a healthy amount of respect for what the Metropolitan police are doing for everybody," she says.

Jill Halfpenny, who plays one of the Territorial Support Group, says that the cast all left this job with a renewed respect for what the police do: "We're going to try and be as real as possible but it's also entertainment, so it's getting that balance. Of all the people we met, everyone was really proud to be in the police."

Though they admire and respect the police, Bain and Armstrong don't tend to write cuddly, sympathetic love letters to their subjects. The Babylon pilot is actually very Four Lions in tone. Without warning, something truly horrific happens and within seconds you're laughing again.

Jimmy Nesbitt ventures: "There will be comedy in it but the sort that is born out of truth rather than farce."

Many of the biggest laughs emanate from the astonishing performance of relative newcomer Jonny Sweet (you may recognise him from Sky1's first world war comedy Chickens), who plays Miller's staff officer Tom Oliver, and who follows him around with a notepad and a stupefied grin. At one point, a shooting is pinpointed outside a health food shop and Tom seriously wonders: "Could it be Holland & Barrett-related?" He steals scenes all over the place.

Back upstairs, Marling and Nesbitt are crammed into a small, mirrored lift at the far end of the corridor. They're filming a pick-up, with Boyle and co wedged into the narrow passageway outside. The director's high-pitched Lancastrian voice calls action and there's some brief, barely audible dialogue. Then cut. The circus of cables and bodies moves off again to its next pitch. As we walk past the lift on our way out, its back wall stands ajar. A very convincing fake. Babylon is taking the back off the Met so we can all have a good look inside.

Babylon is on Sun 9 Feb, 9pm, Channel 4