The young man charged with murder for bludgeoning his La Guardia High School teacher mom in their Midtown apartment last year — while he was in the throes of an epileptic seizure — was finally sprung on $40,000 cash bail to a locked mental health facility today.

Thanks to an unusual, closed-door bail agreement more than a year in the making, Henry Wachtel, 20, smiled shyly and blinked in the bright spring sunlight as he walked free of Manhattan Criminal Court.

Wachtel then climbed into the waiting car that would take him to La Guardia Airport, where he and a retired detective escort were to board a plane to an out-of-state facility.

Wachtel, who remains charged with his mother’s murder, will stay at the clinic while prosecutors and his lawyer continue to discus if he will take a deal, go to trial or see his charges dropped as his mother’s closest friends and his father, who accompanied him today, are hoping.

It was Wachtel’s first un-handcuffed walk out of doors since last April, when he was arrested for the tragic, caught-on-audio beating of his mother, Karyn Kay, 63. The respected teacher had dialed 911 to summon help for her son when he fell into a violent epileptic seizure.

At some point, Wachtel, apparently still in his seizure, is captured on the 911 recording fatally beating his mother. The murder case has been noteworthy for both its high-profile victim and for the medical-versus-maniacal question of that beating’s motive. Even the judge, Manhattan Supreme Court Justice Jill Konvisor, noted today as she approved the bail release that Wachtel’s case is “painfully unique.”

“Help! Help! He’s attacking me!” Kay screams on the tape. The tape goes on to capture the thuds of the mom and son’s struggle, then the mom’s pitiable final gasps, and finally the son’s own anguished cries.

“Mommy! Mommy! Please don’t die!” he screams.

“It took a team effort by many people to find the hospital that could deal both with Henry’s epilepsy and the psychological trauma of Henry’s death,” his lawyer, Lloyd Epstein, said of the bail arrangement.

It is highly unusual for prosecutors to allow a remanded accused murderer to be sprung on bail to a private psychiatric facility; prosecutors, apparently sensitive to this, explained their decision on the record today in such detail, that a transcript of the explanation takes up two full pages of transcript.

“The unique circumstances of this case raise legal and medical questions that affect the defendant and the public,” lead prosecutor Stuart Silberg told the judge, reading from a prepared statement. “We need to learn more about the defendant’s disorder to properly resolve these questions.”

Prosecutors have had their own retained neuropsychologist examine Wachtel, and that expert has found that the young man’s physical and mental health are deteriorating and his epilepsy is not being treated while he’s been in jail, Silberg said.

“The defendant will not be allowed to leave the facility at any time,” Silberg said.

Officials did not disclose where Wachtel will be housed and treated.

As Wachtel left the courthouse just before lunch today, his court-mandated escort, retired NYPD police detective David Kayen, retained by Wachtel’s lawyer, shoved a New York Post photographer into a police barricade and grabbed his camera.

“I’ll find out what happened,” the lawyer, who was not present, said of the ex-detective’s actions.