A Post reporter followed Brooklyn cops on a stairwell sweep known as a “vertical patrol” in 2012 in the Linden Houses. The ride-along was near the Pink Houses, where Akai Gurley was killed by police Thursday on a similar patrol in a dimly lit stairwell.

Critics who blast the NYPD’s stop-and-frisk policy should try tagging along with cops who do “vertical patrols” — crime sweeps in the city’s most dangerous, gun-ridden housing projects.

Two of New York’s Finest assigned to the perilous detail spent Friday night clad in bulletproof vests as they stepped onto the rooftop of a building in the heart of Brooklyn’s Linden Houses, minutes before making their nerve-wracking, 15-floor descent to the lobby.

Guns drawn, Officers Luis Lerebours and Miguel Vargas, both 28, first swept the roof with flashlights, their radios turned low.

“We try to be as quiet as possible; we don’t want to lose the tactical advantage,” Lerebours told a Post reporter who was also suited up in a bulletproof vest to see them in action.

The two cops are assigned to Police Service Area 2, a command that patrols and protects some of the roughest projects in Brownsville and East New York.

The partners scour the rooftop for anyone who doesn’t belong there.

“Sometimes, people will come up to the rooftop and let off rounds, so we’ve just got to protect ourselves and make sure that our guns are out of our holsters before we enter,” Lerebours said.

Before heading back into the building, the cops also check the roof for anything that can be used as “air mail” — debris thrown from windows or roofs onto cops on the ground responding to crime scenes.

Then they make their way into the building at 245 Wortman Ave., where Vargas and Lerebours will go floor by floor in the stifling heat, moving stealthily down each darkened corridor, looking for guns, drug transactions and other criminal conduct.

They take turns checking hallways — with one cop staying back to prop open the stairwell door in case trouble erupts and they need to take cover.

The biggest danger on a vertical, the cops said, is the close quarters. If they startle someone carrying a gun, there’s nowhere to duck.

“If someone is up to no good, you turn the corner and there’s somebody waiting to rob someone or you walk into a drug transaction,” said Sgt. Erick Nolan, the team supervisor.

Friday night, Vargas and Lerebours also checked the terraces overlooking the front yard, where residents cool off on hot nights. As elsewhere, they searched for signs of drug use and took note of broken lights that create pockets of shadow — natural hiding places for muggers or violent thugs.

The building’s lobbies, elevators and stairwells reeked of urine. Faded paint was peeling off of dingy walls. Hip-hop music and the cries, or laughter, of children echoed off the walls as the cops descended through the heart of the building.

The night was peaceful, but there’s no way to know when violence will erupt or where.

“There are some buildings that don’t have as much activity as others, but for the most part, they can all get pretty thick,” Lerebours said.

Fresh in the young cops’ minds was the July 4 weekend shooting of NYPD Housing Officer Brian Groves, 30, who was on a vertical patrol when he was shot in the Seward Park Public Housing Development on the Lower East Side in Manhattan.

Groves and his team had opened a stairway door to discover a man with a gun. They chased him down four flights to question him, and the suspect fired a silver revolver, hitting Groves. He was saved by his bulletproof vest. The shooter is still at large.

The incident gave fuel to supporters of the Police Department’s controversial stop-and-frisk weapons policy.

“Things like Officer Groves, that’s in the back of your mind,” Vargas said. “You don’t want to turn the corner and run into something like that.”