The litigation brought by Stormy Daniels against Donald Trump has had its day of reckoning. The adult-film star who sued the president for defamation not only lost a portion of her lawsuit but was ordered to pay the president's legal bills. All this was a resounding victory for the freedom of speech.

After the right to life, protected by the Fifth and 14th amendments, and the right to be left alone, protected by the Fourth, the freedom of speech, protected by the First, is our most cherished. James Madison, who drafted the Bill of Rights, was careful to refer to speech as "the" freedom of speech so as to underscore the Framers' unambiguous belief that free speech is pre-political. Stated differently, it existed before the government did and thus did not come from the government. As it does not originate in the government, Madison and company believed it originates in our humanity.

Earlier this week, a federal judge in Los Angeles ruled that Daniels' efforts to use the courts to punish the president for his exercising the freedom of speech were frivolous.

Here is the back story.

Daniels claims that she and Trump had a consensual sexual encounter in a Lake Tahoe hotel room in 2006, shortly after Trump's youngest son, Barron, was born. On CBS' "60 Minutes" program, she told Anderson Cooper of the sexual experience in vivid and graphic detail. Trump has denied many times that he had a sexual encounter with Daniels.

Daniels also told Cooper that she had been with Trump in public after their encounter, and she produced a photo of them together in a public place. She then told him that after she and Trump had ended their friendship, a stranger approached her in the parking lot of a Las Vegas fitness center and threatened to harm her if she failed to keep the existence of her relationship with Trump quiet.

She even produced a sketch of a man she said depicted the person who threatened her. In the same interview, she revealed that Michael Cohen, then Trump's personal lawyer and today a government witness against him, paid her $130,000 to remain quiet about her alleged affair with Trump, and she accepted the money and agreed to stay quiet.

Trump wasn't having any of this. He tweeted that the depiction of the man Daniels claimed threatened her bears a striking resemblance to her former husband and that she had made up the story of their sexual encounter, as well as the story of the parking lot threat. He called the version of events she gave to Cooper a "con job."

While Daniels' back-and-forth with Trump was going on, her lawyers filed litigation in federal court seeking to invalidate the nondisclosure agreement she signed with Cohen and accusing Trump of defamation when he said she had pulled off a con job. On Monday of this week, at Trump's request, a judge dismissed the defamation claim.

Bad cases often make good law, and this is one of them. Whether one believes Daniels or Trump about what may have happened in a Lake Tahoe hotel room 12 years ago, one can appreciate the free speech values at play here. The Bill of Rights in general — and the First Amendment in particular — articulates negative rights. Stated differently, the First Amendment doesn't grant the freedom of speech (we know that from Madison's use of the word "the" preceding the word "freedom"); rather, it negates the ability of the government, which includes the courts, to infringe upon speech.

The "free" in "free speech" means free from government infringement. So, if Daniels calls Trump directly or by implication an adulterer on national television, he can take to Twitter to proclaim that she has perpetrated a con job — and he can do so with impunity.

The failure of the courts to protect Trump's right to challenge his accuser's veracity in public — or the use of the courts to attempt to intimidate Trump from proffering that challenge by making him pay for it — would have constituted an infringement by the government of Trump's free speech rights.

Sending a signal that there was no legal basis to claim that "con job" in reply to "adulterer" was defamatory and unwilling to be the instrument through which speech — even the rough-and-tumble variety Trump often employs — could be punished, deterred or infringed upon by the government, the court found Daniels' defamation claim to be frivolous. She and her lawyers ought to have known the defamation claim would not prevail, and thus she or they (at this writing, it is unclear who) were ordered to pay the legal bills Trump incurred for defending the defamation claim.

The United States has a long and storied history with the freedom of speech. The same generation that ratified the First Amendment — in some cases, the same human beings — also enacted the Alien and Sedition Acts, which prohibited speech defamatory of the government. Thomas Jefferson pardoned all who were convicted under this dreadful and unconstitutional law, including a member of Congress. Yet Abraham Lincoln, Woodrow Wilson and Franklin Roosevelt all punished dissenters for the anti-war speech they uttered in wartime, and they got away with punishing them.

But since a unanimous opinion in 1969 involving hateful words uttered by a Ku Klux Klansman, the Supreme Court has held that all innocuous speech is absolutely protected from government interference and that all speech is innocuous when there is time for more speech to challenge or rebut it. This has led to our robust modern jurisprudence, which declares that individuals decide for themselves what to say and hear. The government does not decide for us.

In America, it may take a tawdry tale of sex in a hotel room to bring these values to light.

Andrew P. Napolitano, a former judge of the Superior Court of New Jersey, is the senior judicial analyst at Fox News Channel. Judge Napolitano has written seven books on the U.S. Constitution.