The cop who fatally shot an unarmed teen on a Brooklyn roof is set to testify before a grand jury today – one day after his union demanded that Police Commissioner Ray Kelly resign amid charges he rushed to judgment in calling the shooting unwarranted.

Officer Richard Neri is expected to tell grand jurors investigating the Jan. 24 shooting of Timothy Stansbury, 19, that he was startled when his partner stumbled after the roof door leading to a housing project stairwell swung open and that he fired involuntarily, sources said.

Neri will also say he didn’t even realize he had fired a shot until later, the sources said.

Hours after Stansbury was mortally wounded, Kelly said that “at this point, based on the facts that we have gathered, there appears to be no justification for this shooting.”

Yesterday, Patrick Lynch, head of the Patrolmen’s Benevolent Association, which represents 23,000 rank-and-file cops, blasted the commissioner for his alleged “premature judgment” after union delegates took a “no confidence” vote in Kelly and called on him to step down.

“This commissioner does not afford the benefit of a doubt to the very police officers who risk their lives to make this city safe,” the PBA head said. “The message that Commissioner Kelly has sent to police officers is ‘Do your job, risk your life, but you are on your own.’ “

Mayor Bloomberg staunchly stood by his commissioner, saying that “we should take a no-confidence vote on the PBA.”

“We have the best police commissioner this city has ever seen. He’s done exactly what’s right. When he sees information, he puts it out. The public has a right to know. It’s the public’s information,” the mayor said.

“And this police commissioner has defended the Police Department better than anybody ever has. His record is impeccable.”

NYPD spokesman Paul Browne said in a statement that “by promptly and candidly reporting on the Stansbury shooting, the police commissioner performed a public service for police officers and the community alike.

“Some critics are too narrowly focused to appreciate that fact,” he said.