Recent events have taught many of us a key fact about the criminal justice system that we may not have understood.

The most important element of the system is not the police, the judge or the jury. It is the prosecutor.

The prosecutor decides on sending cases to trial, the crime charged, the potential punishment, if there is enough evidence to convict, and the priority of the alleged crime in light of available resources, including prison space.

The decision to proceed may lead to a preliminary hearing before a judge to ensure that the prosecutor is not abusing the broad right to proceed to trial. Or the prosecutor may choose not to proceed, allowing the person arrested to go free.

A prosecutor may have to refer a possible crime to a grand jury, which can decide if there is sufficient “probable cause” to go to a full trial.

In a grand jury, the prosecutor and witnesses are heard and subject to questioning by the jurors. Defense lawyers do not get to cross-examine, and the defendant may not testify.

It is generally accepted that, if a prosecutor wants a grand jury to indict an accused person, it happens. A judge once famously said that a prosecutor could get a grand jury “to indict a ham sandwich.”

We have recently had three cases of the exercise of this “prosecutorial discretion.” They have all raised considerable controversy and extreme reactions.

In both Ferguson, Missouri, and Staten Island, New York, a police officer killed a person. The police officer was white and the slain person was black.

In both cases, a grand jury considered a possible charge. The prosecutors may have liked using a grand jury so that, avoiding their possible bias in favor of the police, there would be an independent judgment of the incidents.

Neither grand jury indicted the police officers involved. Critics might conclude that, on their own, the prosecutors would have declined to proceed. If they were not aggressive in front of the grand jury, they may have achieved the same result, but without taking responsibility for it. If so, prosecutorial discretion extended right into the jury room.

In the Missouri case, there was no objective way for others to know for sure what had happened. Witness accounts differed, but there would be no trial. The family of the person killed by the police called for wider use of police body cameras, which should make the facts obvious.

But, in the Staten Island case, there was visual evidence available to both the grand jury and the public. The slain person had not threatened the police, but had been cornered by several officers for the alleged crime of selling loose, untaxed cigarettes. Despite his protest, he was thrown to the ground and choked to death.

We do not know what the grand jurors thought, but it is probably safe to assume that the prosecutor did not press hard for an indictment. In fact, he had granted immunity to all officers involved but one, possibly letting off a person easier to indict than the accused officer.

It is not difficult to conclude that the prosecutor led the grand jury to let the police get away with an unjustified killing. That may be extreme use of prosecutorial discretion.

When we elect a district attorney, we give the prosecutor that kind of power. Perhaps, in cases involving the police, appointing an independent prosecutor from a distant jurisdiction would make sense.

The final case came with President Obama’s decision to allow millions of illegal entrants to stay in the United States, avoiding deportation. While they gain no rights or benefits, they avoid the threat of their lives being disrupted, at least as long as Obama is president.

Obviously, Obama acted because he thought something like his action would be part of immigration reform legislation. Though such legislation has little chance of getting out of a GOP-controlled Congress, he was trying to goad it into action.

Federal law enforcement agencies are under the president’s control. Congress has limited the funds available to him for border enforcement. Lack of resources to pursue all law-breakers is a factor allowing prosecutorial discretion to be used in setting priorities.

What is unusual about Obama’s action is that it applies to so many people. Usually, we think of prosecutorial discretion applying in individual cases, not to groups of people breaking the law.

All of these cases suggest yet another factor for prosecutorial discretion ”“ politics, whether its the president pushing Congress or a prosecutor protecting the police.

— Gordon L. Weil is an author, publisher, consultant, and former official of international organizations and the U.S. and Maine governments.