Unions of football players and police officers are still strong organizations — even as the rest of the labor movement unravels. But scandal in the National Football League and murder on the streets of New York City has many people asking if these high-profile unions are too strident in defending their members.

In the wake of the assassination of two police officers, the president of the Patrolmen’s Benevolent Association charged that Mayor Bill de Blasio and all other officials who recently criticized police conduct “have blood on their hands.” The police union had been staunchly defending Staten Island officers whose July arrest of Eric Garner ended in his death. In Ferguson, Missouri, and in other cities, police unions have also vigorously defended officers against charges of unnecessary use of deadly force.

The National Football League Players Association has been equally vociferous in defending its members. When an elevator camera caught Baltimore Ravens star running back Ray Rice knocking out his then-girlfriend, now wife, the players union was quick to appeal his indefinite suspension. After union pressure, a neutral arbitrator vacated the suspension in November, making Rice eligible to play football again.

Both unions seem arrogant and contemptuous of a public that wants cops under control and misogynous football players properly penalized. If this is what militant unionism looks like, many say, we don’t want it.

But there are two issues involved here — and they need to be disentangled. First is what a union does to defend its individual members when they get into trouble. Second is the civic and political roles that unions play in society, and the collective posture taken by a union when it confronts an employer or seeks political influence. The two are very different — often seeming in utter contradiction.

Like a defense attorney who represents an unsavory client, unions have a duty to defend every member when he or she gets into trouble. The courts codify this as a “duty of fair representation,” which means unions can’t pick and choose the grievances that arise out of their membership. Some will be more worthy of defense than others — but even members who employers penalize for gross misconduct have a right to their day in court. Under most union contracts, this means the right to come before an arbitrator agreeable to both labor and management.

“The contract is your constitution” the United Automobile Workers advised its members more than 70 years ago, when this system was just getting set up, “and the settlement of grievances under it are the decisions of an industrial supreme court.”

Of course, it is one thing for a labor organization to defend a member denied a job promotion and quite another when he or she violates criminal law. No one would expect the autoworkers union to defend a member who robbed a bank — or beat his wife.

But this issue grows cloudy when workers are held accountable 24/7. The NFL requires players, coaches, officials and many others to avoid “conduct detrimental to the integrity of and public confidence in the National Football League.” Meanwhile, the police are never really “off-duty.” Their job also frequently requires the use of physical force that would be illegal in any other work environment. When they are accused of a serious transgression, they are subject to discipline not only from their police superiors but also under criminal law.

It is therefore not surprising that a union of football players or police officers will hire lawyers to defend one of their members charged under the law or facing a penalty for irresponsible conduct meted out by their employer. Everyone deserves their day in court.

But there is another issue in play. Unions are political institutions, and few are more influential than those composed of police or the celebrity athletes whose exploits on and off the field are followed by millions. Union members elect their leaders to speak out on the issues of the day, to debate adversaries, endorse candidates and mobilize support.

But that does not mean union officials are always right. And in these recent controversies, they aren’t.

Pat Lynch, head of the New York police union, is digging a disastrous civic and racial gulf when he encourages his members to turn their backs on a mayor who won election in part with talk of reforming police arrest and patrol practices. The New York Police Department can’t be a militia at odds with municipal officials it considers too liberal.

Similarly, the NFL union cannot continue to overlook its members’ cases of domestic abuse. Americans still watch many hours of professional football, but their tolerance for wealthy, protected players’ acts of violence has its limits.

Unions must defend their members, but they can’t do it if they isolate themselves from the American public.

PHOTO (TOP) Law enforcement officers turn their backs on a live video monitor showing New York City Mayor Bill de Blasio as he speaks at the funeral of slain New York Police Department officer Rafael Ramos near Christ Tabernacle Church in Queens, New York, December 27, 2014. REUTERS/Shannon Stapleton

PHOTO (INSERT 1): Former Baltimore Ravens NFL running back Ray Rice and his wife Janay arrive for a hearing in New York, November 5, 2014.REUTERS/Mike Segar

PHOTO (INSERT 2): New York Police Commissioner Bill Bratton appears at a press conference about the two police officers who were fatally shot in the Brooklyn borough of New York, December 22, 2014. REUTERS/Carlo Allegri

PHOTO (INSERT 3): New York City Patrolmen’s Benevolent Association president Patrick Lynch speaks to the media at Woodhull Hospital about the two New York Police officers who were shot dead in the Brooklyn borough of New York, December 20, 2014. REUTERS/Stephanie Keith