There was the Air Force veteran inside the Senate Chamber during the Capitol riot wearing tactical gear, and the New Jersey reservist who works at a naval weapons station. There was the Air Force veteran shot and killed by beleaguered Capitol police as she shoved through a shattered window.

The presence of service members and vets at the Capitol riot should have come as no surprise to a Pentagon that has long downplayed the problem of white nationalism and far-right activism in the ranks — despite warnings for decades. The number of service members involved on Jan. 6 is still unclear, but National Public Radio reported Jan. 21 that of more than 140 rioters charged to date, nearly 20% were serving or former military.

“The job of the Department of Defense is to keep America safe from our enemies. But we can’t do that if some of those enemies lie within our own ranks,” the new defense secretary, Lloyd Austin, warned Congress.

The Biden team is now scrambling to assess the threat of domestic extremism, a threat inflamed by the Trump White House. Suggestion: Take a look at the approach of another country facing far-right infiltration of its armed forces. Despite the differences in their history, America can learn from Germany’s response.

» READ MORE: Biden's first foreign policy test will be fixing the vaccine mess | Trudy Rubin

So argues Cynthia Miller-Idriss, author of Hate in the Homeland: The New Global Far Right and head of the Polarization and Extremism Lab at American University. “U.S. officials must take this threat to national security as seriously as their German counterparts have done,” she writes in the December issue of Foreign Affairs, “or they risk imperiling the constitutional protections that law enforcement and the military are sworn to uphold.”

Of course, Germany has a history that has made the country especially sensitive to right-wing violence. Even there, the authorities long viewed such extremism in the military and security services as individual “bad apples.” No more.

Last year, Germany uncovered networks of rank-and-file sympathizers in the country’s security services. Germany’s domestic intelligence service recorded more than 1,400 cases of suspected far-right extremism among soldiers, police officers, and intelligence agencies in the three years prior to March 2020.

Spurred by hostility to the arrival of 1.5 million mostly Muslim refugees in 2015-16, German police and military have been joining far-right chat rooms and sharing neo-Nazi propaganda and talking of Day X – the mythical moment when Germany will collapse and the far right take over.

A whole company of Germany’s elite special forces was disbanded last year after explosives, weapons, and SS memorabilia were stolen.

German officials are still learning how to cope with far-right infiltration of law enforcement, but their methods of response provide (controversial) food for American thought.

“We have a better idea of the scope of the problem,” I was told by Daniel Koehler, director of the German Institute on Radicalization and De-Radicalization Studies in Stuttgart. Germany has a huge number of governmental and nongovernmental programs aimed at preventing and combating violent extremism – known by their acronyms as PVEs and CVEs.

PVE programs include “a long tradition of civic education,” said Koehler. They offer basic knowledge about rule of law, and the meaning of pluralism, along with lessons on fake news, and debates on current political issues. PVEs also include health and family counseling.

German intelligence tracks extremists, even those who haven’t committed criminal acts. A military intelligence bureau identifies all extremists in the armed services.

This is possible, said Koehler, “because Germany has a clear definition of extremism, how it affects democracy and human rights. Without a clear definition, you can’t confront it.

“If someone believes people should have different rights because of religion or race … that is extremist. You have to screen attitudes in the military because extremists don’t believe in rule of law.”

The upshot of this surveillance is that Germany has very robust data on “extremists” of any ideology. That enabled German officials to report last year a more than 50% increase in the number of right-wing extremists since 2014. The head of Germany’s domestic intelligence identified far-right extremism as the “biggest danger to Germany democracy today.”

Of course, the identification of “extremists” before they commit a crime would be seen here as a First Amendment violation. Yet the German approach clarifies something the United States must do to confront radicalism in the military and in society at large.

“We have to define as a society what is anti-democratic and what ideology is within democratic boundaries,” Miller-Idriss told me. “What is against minority rights, what is freedom of speech, what promotes violence for political gains.” That means defining whether activities such as joining a racist chat room or involvement in a militia calling for civil war cross a red line.

» READ MORE: The violence Trump fueled will threaten America long after he leaves I Trudy Rubin

Unless we reach consensus on what constitutes anti-democratic behavior we will struggle to uproot it, in the military and outside it.

Perhaps it requires a bipartisan national commission to investigate the roots of the Capitol riots, and the risks from right-wing militia movements and conspiratorial groups such as QAnon -- along with the crazy media that support them. Germany may provide an imperfect example, but it at least doesn’t shy from facing the threat to democracy head-on.