Bernie’s on the brink.

Disgraced ex-top cop Bernard Kerik has been exhibiting psychiatric “symptoms” behind bars and is considered “at risk” by a jailhouse shrink, the judge in his corruption case revealed yesterday.

Sources who have known the former NYPD commissioner for years told The Post they weren’t surprised that the fallen hero of 9/11 was apparently losing it in the slammer.

Kerik can’t stand humiliation, the sources said, and was totally despondent after the 2004 debacle when corruption allegations derailed his nomination to head the federal Department of Homeland Security.

Some friends even worried at the time that he might hurt himself, the sources said.

Judge Stephen Robinson said he got an unusual memo and later spoke with Westchester County Jail psychiatrist Dr. Robert Mahler, who expressed worries about Kerik’s condition since being moved to a special unit after being locked up last week.

Robinson said “it was clear to me in that conversation that there was more going on than simply Mr. Kerik being placed there because of his notoriety, status, or the circumstances of this case.

“The concern was not ordinary,” Robinson said. “There were things described to me that were either said or done that raised a level of concern for them such that I left the conversation with Dr. Mahler not feeling that this was an issue that could be ignored.”

The judge said Kerik, 54, might have to waive his right to doctor-patient confidentiality or undergo a court-ordered exam, and Robinson told both sides to get more information by Monday.

Robinson also said the situation might force another delay to Kerik’s trial, set to begin on Nov. 9.

Kerik — who had his bail revoked on Oct. 20 for giving a supporter sealed court records — did not speak during the hearing in White Plains federal court.

He wore a suit but no tie.

Defense lawyer Barry Berke said Kerik — who initially asked to be housed among the jail’s general population — was instead put in “essentially a lockdown most of the day,” and that “because of the stress of this situation, as well as the stress of the confinement,” he agreed to a staffer’s suggestion that he be moved to the special unit.

Berke said Kerik was not being medicated, but was “regularly speaking” with the staffer who suggested the move.

Berke would not answer reporters’ questions afterward.

Jail spokesman Justin Pruyne said Kerik returned to the lockup after his court appearance and “remains segregated from the general population, as he has since intake, based on his law-enforcement background,” but wouldn’t comment further.

The jail has a psychiatric unit, but officials would not confirm that Kerik is there.

Additional reporting by Liz Sadler and AP

kati.cornell@nypost.com

