As every day brings a new outrage, it is readily apparent that bail reform is a failure. The fix is simple: Give judges back their discretion to make bail determinations.

In my 30-year legal career, I have served as an assistant district attorney, a criminal-defense lawyer and a criminal-court judge. For five of my 10 years on the bench, I sat in Brooklyn night court, handling thousands of arraignments.

If I were still a judge, I would not be able to function in this environment, and I can’t imagine how my former brothers and sisters on the bench can when assigned to arraignments.

Under the reforms, all discretion has been removed from criminal-court judges. Before, a judge could make a determination as to whether bail was necessary to insure a defendant’s return to court.

There were several factors they could consider — ties to the community, prior contacts with the criminal-justice system and prior failures to return to court were among the factors.

With the new law, judges are nothing more than automatons, relegated to checking boxes on a list of least restrictive options for people they must release. Almost no consideration is given to whether these persons have other cases of a similar nature pending, have a history of failures to appear or are likely to obey the court’s directions.

I don’t dispute whether the system is unfair or racist or works better for a wealthy defendant. These issues have always been up for debate. What I am saying is this new law is the wrong solution to the perceived problem.

When I sat in Brooklyn night after night, I saw the range of human experience: Some defendants were hapless drug addicts; some were harassing ex-spouses; some had no respect for the law. In an average night, I’d see, say, a 17-year-old arrested for robbing a 13-year-old, or a 24-year-old nabbed for fare-beating with three other fare-beating cases pending. Or maybe someone with seven cases pending in the misdemeanor drug-treatment court.

Using my discretion, and following the factors enumerated in the statute, I could decide whether bail was necessary to ensure defendants’ return. I knew one size did not fit all; each defendant was an individual, with his or her own unique circumstances.

I could insist the 17-year-old have a parent or guardian present before I would release him. I could remand the person with a new arrest to appear in the drug-treatment court the next day.

By taking away a judge’s discretion, Gov. Andrew Cuomo and the Legislature have encouraged cases like those of Tiffany Harris and Eugene Webb. Both were arrested for crimes of violence several times and released, only to be arrested again for further crimes of violence.

In each case, if the court still had its discretion, it could’ve determined whether to set bail, and the public might have been protected from further incidents.

Instead, in Harris’ case, the mayor’s office found it necessary to intervene and seek a mental-health evaluation (even though technically Harris may not fit the criterion for such an examination; she appears to understand the charges against her and seems capable of aiding in her own defense).

Taking its cue from the Harris matter, the court also ordered a psychiatric exam for Webb.

Then there is Gerod Woodberry, arrested for the robbery of four banks and released without bail, only to be accused of robbing two more banks after his release. Even the defendant expressed surprise at his release, asking, “What were they thinking?”

Harris and Woodberry’s cases have now been turned over to the federal courts, a clear sign of the helplessness of local authorities. Yet how often can we expect to see the federal authorities assume the responsibility of prosecution?

How many more times will a series of crimes be tolerated from the same perpetrator? How often will the mayor’s intervention be necessary in future cases? If Harris or Webb is found competent, how many more times can they be released, rearrested and released yet again?

How many more people like Harris, Webb and Woodberry will be allowed to exhibit disrespect for the law and thumb their noses at a court helpless to stop their violent and dangerous behavior?

Rather than carve out exceptions for hate crimes or tinker at the edges of this law, the Legislature must restore judges’ discretion to set bail. Without discretion, a court cannot give the people what they need and expect: justice.

John H. Wilson currently serves as a mediator for First Court, a private company.