When Ray Kelly, the man Barack Obama is currently considering to lead homeland security, was the New York City police commissioner, he allegedly had a policy of terrorising black and Latino neighbourhoods.

A hearing into the city's stop-and-frisk policies in spring heard how Kelly told state senator Eric Adams that "he targeted and focused on [black and Latino youth] because he wanted to instil fear in them every time they left their homes that they could be targeted by the police". The hearing also heard a secret recording of South Bronx deputy inspector Christopher McCormack telling a subordinate to stop "the right people at the right time, the right location", and focus stop-and-frisks on "male blacks" between 14 and 21.

A decision on the constitutionality of the city's stop-and-frisk practices is expected any time now, marking the latest in a summer of legal showdowns that have exposed both the power and partiality of the American state. Many who previously understood the legal system and its enforcers to be dispassionate arbiters of justice working in the interests of society as a whole have been forced to re-evaluate their assumptions.

First came the trial of Bradley Manning, charged in a military court with "aiding the enemy" for passing diplomatic cables and other classified military information to WikiLeaks. Then came the manhunt for Edward Snowden, the former National Security Agency contractor, who leaked evidence of mass snooping. More recently there was the trial of George Zimmerman, the neighbourhood watchman in Florida who pursued Trayvon Martin, a young, black, unarmed teen, and shot him dead after Martin confronted him. Soon will come the verdict on stop-and-frisk.

Each, clearly, is its own case, with its own dynamics, outcomes and facts on the ground. There are many who will favour prosecution in one case but not in another. The point here is not that the cases raise identical issues.

And yet for all their glaring differences they share at some crucial traits: each, in its own way, raises fundamental questions about the function and purpose of the American state, the moral underpinnings of the legal system in which it is grounded, and the degree to which the law is designed to work for or against the people in whose name it operates. In each case, in different ways, the following questions become acute: to whom is the state responsible? Who is it supposed to protect? And who is it supposed to protect them from? Manning faces a sentence of up to 90 years (down from 136) after the "aiding the enemy" count was dropped; Zimmerman was acquitted; Snowden was granted asylum in Russia after his US passport was revoked, leaving him holed up in the Moscow airport for weeks trying to avoid extradition.

Snowden's case is the most blatant. The government insists the mass collection of phone data and surveillance of internet communications – much of which is overseen by a court that few knew existed and which operates in secret – is essential to keep people safe. When questioned about the existence of this type of surveillance, those in charge of it lied "for reasons of security". If people knew they would worry, went the argument, they are safer in their ignorance. Trust us and move on; nothing to see here. Put bluntly, Americans have been told that they are being spied on and misinformed for their own good, leaving them simultaneously infantilised and criminalised.

Zimmerman's acquittal is the most challenging because this ostensibly was the judicial system working as it should, complete with televised trial by jury. The acquittal on grounds of self-defence essentially means an unarmed boy has no legal protection against an armed man who, ignoring the advice of the police, decides to follow and shoot him. In such a situation the insistence that the jury faithfully upheld the law is not comforting but deeply troubling. For it confirms the suspicion that the law is deeply selective in terms of whom it seeks to protect and to pursue.

The stop-and-frisk case combines the paternalistic logic of the NSA with the crude "policing" strategy of Zimmerman. The NYPD's defence has been that it is in the best interests of the people who live in certain neighbourhoods to have their sons, lovers and fathers systemically profiled and systematically harassed. In the hearings McCormack was also recorded saying: "99% of the people in this community are great, hardworking people, who deserve to walk to the train, walk to their car, walk to the store, without becoming crime victims." Kelly's defenders say he was referring to policing in high-crime areas in general. This is their defence: we must terrorise this village in order to save it.

Those who defend this version of the all-powerful, all-caring state have little choice but to demonise those who oppose it. They assume their powers on the basis that they are best qualified to know what's best for the public, even when the public thinks differently. Those who challenge such hubris are dealt with severely. The enemy in the NSA scandal is not those who are spying on you and lying about it, but the one who tells you about it. The criminal, in the Manning case, is not the soldiers who murder innocent civilians and laugh about it or the politicians who sent them to war but the young man who exposes their crimes.

The state is right to be worried. For while it has aggregated power, it has failed to garner the influence to sustain or justify it. Manning said he hoped by releasing the cables he would spark "worldwide discussion, debates, and reforms". The leaks informed the Arab spring, revealing the venality of the leaders and the complicity of the US. When Snowden came out as a whistleblower, he said his greatest fear was "that nothing will change". As Obama moves to modestly reform the NSA, the public he claims to be protecting shows growing support for Snowden. Neither the government nor the judiciary has been able to point to a single credible example of how its secrecy, neglect, deception or persecution in these cases has protected anybody or anything. When they insist such measures are crucial for security, they evidently mean security of the state – not the people who live in it.

Following Zimmerman's acquittal, Obama was keen to point out that "America is a nation of laws". Nobody doubts that. What is less clear is whether it is a nation of justice.

• This article was amended on 14 August 2013. An earlier version said that Manning was sentenced to 90 years in jail. At the time of writing, Manning has not yet been sentenced.

Twitter: @garyyounge