The partner of a heroic Brooklyn cop slain in the line of duty was near death last night after a grisly motorcycle accident on Staten Island, law-enforcement sources said.

NYPD Detective Paul Lipka, 40, was heading to work on his motorcycle when he collided on Richmond Terrace with a Nissan Altima that was making a left onto Snug Harbor Road in Livingston about 9:30 a.m., sources said.

Lipka, who is assigned to the Fugitive Enforcement Division and lives not far from the scene of the accident, suffered a severe neck injury, sources said.

The father of three was rushed by ambulance to Richmond University Medical Center, where he was placed on life support.

The detective’s family members were waiting for his father to fly to New York from Florida before they took him off the ventilator, sources added.

Police were probing whether Lipka was cut off by the Nissan driver, sources said. The 43-year-old motorist has not been charged, and has not been issued any summonses so far in the investigation.

He passed a Breathalyzer, and has a valid driver’s license, sources said. Police also are investigating whether speed or cellphones played a role in the accident.

Lipka, a 12-year veteran with almost 100 arrests, worked alongside Officer Dillon Stewart, who was fatally shot in 2005 during a car chase in East Flatbush.

Lipka and Stewart were on patrol, monitoring a nightclub in an unmarked police car while in uniform. They began chasing a car driven by Allan Cameron, 27 at the time, after it blew a red light.

When they drove up alongside Cameron, the driver fired six shots, hitting Stewart in the armpit.

The brave cop didn’t realize he had been shot, and continued pursuing Cameron to a garage. Lipka fired two shots at the car before the garage door closed.

Stewart then realized he had been hit. The bullet struck his heart, and he died in surgery.

Lipka kept his composure when he testified in court about the night his partner was slain.

Cameron was convicted of first-degree murder in Brooklyn Supreme Court, and sentenced in 2007 to life without parole. He had also shot an off-duty officer during a street robbery in Crown Heights.

After Stewart’s death, the city spent $12 million to purchase police bulletproof vests that provided better coverage for cops’ bodies.