The accused Brooklyn Ripper demanded to speak privately with the judge Wednesday in Brooklyn Criminal Court ​– as the brave little girl who survived his deadly stabbing spree finally got out of the hospital.

“Your honor, is it all right if I have a moment with the court? A short moment?” bellowed a glowering, belligerent Daniel St. Hubert, 27, clad in an orange ​jail ​jumpsuit with his hands shackled.
“No f–​-​ ing way!” a woman in the gallery ​ screamed in response, and the judge agreed.

​Shortly after the court appearance, Mayor de Blasio ​announced that Capers is heading home after spending 10 days in New York Presbyterian Hospital recovering from her devastating stab wounds.

“Thank God that Mikayla Capers is out of the hospital today. Her life is a testimony to perseverance and strength,” the mayor said while announcing that the city would spend $27 million to install security cameras in 49 city public housing projects – including 17 Wednesday at the Boulevard Houses in East New York, where the stabbings took place.

“It’s sad it had to take a tragedy for them to realize cameras were needed. It should have been done [sooner] — it’s for the safety of the community,”

she said. “As long as it’s happening, I’m happy — I know that my nephew didn’t die in vain.”

Critics blasted the city for its failure to install more cameras in the crime-plagued projects – and de Blasio pointed the finger squarely at the Bloomberg administration.

“The previous administration dropped the ball in a big way… My administration should have done better in our first months as well,” he said.
St. Hubert was indicted on one count of second-degree murder, one count of second-degree attempted murder, one count of first-degree assault, and one count each of third- and fourth-degree criminal possession of a weapon. He faces up to 50 years to life in prison if convicted.

Meanwhile, law enforcement sources said cops are closer to linking St. Hubert to the fatal May 30 stabbing of 18-year-old Tanaya Grant-Copeland in East New York.

“We are closer on the female. We are waiting on DNA testing being done in the lab. DNA and other evidence as well before we can charge him in the case of the 18-year-old female,” a source told The Post Wednesday.

​St. Hubert is also suspected in the June 4 stabbing of a homeless man in a Chelsea subway ​— though he has not been charged with either crime.

St. Hubert is expected to stay at Bellevue​’s criminal psych ward ​for the near future because correction brass are concerned about moving him to Rikers Island, where other hardened inmates have already threatened his life.

​P.J. and his pal ​Mikayla — who is still recovering at New York ­Presbyterian Hospital — were on their way to get ices when St. Hubert walked into the​ir​ elevator in the Boulevard Houses in East New York and told them to “Shut up.”

When the excited children did not pipe down, he hacked at them with a kitchen knife, repeatedly stabbing each of the defenseless kids.

St. Hubert was linked to the butchery by his DNA, which was recovered from a knife dropped at the scene, by his fingerprints on the elevator and by three eyewitnesses.