Editor's note: Peter Bergen is CNN's national security analyst, a director at the New America Foundation and the author of "Manhunt: The Ten-Year Search for bin Laden -- From 9/11 to Abbottabad." Jennifer Rowland is a program associate at the New America Foundation.
(CNN) -- At a hearing on Tuesday, Maj. Nidal Malik Hasan, the Army psychiatrist accused of killing 13 people at Fort Hood, Texas, in 2009, for the first time publicly explained that he was motivated by a desire to protect the leadership of the Taliban -- in particular, Mullah Mohammed Omar, the overall leader of the movement.
Prosecutors say that as Hasan opened fire on a room full of soldiers filling out paperwork for their upcoming deployments to Afghanistan and Iraq, he shouted "Allahu Akbar! (God is great!)"
The massacre at Fort Hood is part of a trend of "homegrown" al Qaeda-inspired terrorist attacks and plots against U.S. military targets.
For those individuals who buy in to the late Osama bin Laden's key claim that the U.S. is at war with Islam, American soldiers who are fighting wars in Muslim countries make compelling targets. Indeed, more than a quarter of all the jihadist extremists who have carried out or plotted attacks inside the United States since the 9/11 attacks have targeted the U.S. military.
Since 9/11, 21 people have plotted to attack American soldiers or military installations, according to a count by the New America Foundation.
Before he went on his rampage at Fort Hood, Hasan had contacted the radical Yemeni-American preacher Anwar al-Awlaki over the Internet to ask whether it would be permissible for a U.S. soldier to kill his comrades in the name of Islam.
Al-Awlaki's responses were noncommittal, and although the conversations were a red flag to some law enforcement officials who were monitoring these communications, those officials did not alert the military.
A Pentagon report released after Hasan's attack found that the military's official relations with the FBI's Joint Terrorism Task Forces were "inadequate," which might have contributed to the failures to communicate about the threat some law enforcement officials suspected Hasan might pose.
Here are some other examples of plots or actions that targeted the military:
• A few months before the Fort Hood attack, another jihadist extremist killed a U.S. soldier at a military recruitment center in Little Rock, Arkansas. Abdulhakim Mujahid Muhammad, a convert to Islam whose preconversion name was Carlos Bledsoe, had also attracted attention from federal law enforcement. Despite being questioned by the FBI about a suspicious trip he had recently taken to Yemen, Muhammad was able to obtain a semiautomatic rifle, a pistol and ammunition, as well as the ingredients for a Molotov cocktail.
• A month after Muhammad attacked the military recruitment center in Arkansas, a Muslim convert named Daniel Patrick Boyd was arrested along with six other men, accused of leading a terrorist cell that plotted to attack the Marine base at Quantico, Virginia, outside Washington. Boyd had a history of run-ins with the law, but his group still managed to amass weapons and conduct paramilitary training before they were discovered.
• A similar 2011 plan involved Walli Mujahidh, who plotted with Abu Khalid Abdul-Latif to use grenades and machine guns to attack military recruits at an office complex in south Seattle as revenge for purported atrocities by U.S. soldiers in Afghanistan.
• Four years earlier, a group of Muslims living in southern New Jersey who were virulently opposed to the Iraq War told a government informant they were plotting to kill soldiers stationed at the nearby Fort Dix army base.
In the wake of the attack there, Fort Hood tightened restrictions on who was allowed into the facility, posted more armed guards in strategic locations around the base and implemented the random searching of containers.
An extensive independent review to find the "lessons from Fort Hood" focused on identifying radicalization within the U.S. armed forces, a phenomenon that poses a particularly grave threat because of soldiers' access to weapons and secure military facilities. The review also identified some of the procedural problems that led to the military's failure to prevent the Fort Hood attack.
Following the review, then-Secretary of Defense Bob Gates issued a directive ordering the implementation of 47 recommendations to improve "force protection" at military bases in the U.S.
These included giving military personnel better guidance on identifying suspicious or radical behavior by their comrades, establishing better relations between the Pentagon and the FBI's Joint Terrorism Task Forces and improving communication mechanisms for sharing real-time crisis information across military commands and installations.
But while establishing methods to identify extremists is a somewhat feasible goal in a regimented, closely monitored system such as the military, it is not as easy for authorities to do so in the broader community, particularly when the individuals seem to be "lone wolves" who are not part of a formal terrorist group.
Two attacks last month on soldiers living in the West fit this category.
On May 22, two men rammed a car into British soldier Lee Rigby as he was walking down a street in suburban London. They then hacked at him with a meat cleaver and left his body in the road while a bystander filmed one of the attackers. The slaying was justified as "an eye for an eye, a tooth for tooth ... because Muslims are dying daily."
The following weekend, in what might have been a copy-cat attack, a young Muslim convert who investigators believe "acted in the name of his religious ideology" stabbed a 25-year-old French soldier in a Paris suburb.
He was likely targeted because in recent years, French soldiers have served in Muslim countries such as Afghanistan and Mali.
The suspect, identified only as Alexandre D., first came to law enforcement's attention when he was questioned briefly in 2009. French intelligence services reportedly became aware of the suspect's increasing radicalization in February of this year.
Although there have been no successful attacks on U.S. military targets since the Fort Hood and Little Rock shootings in 2009, six of the 15 jihadist extremists who plotted to attack inside the United States in the past two years were targeting American soldiers or military installations.
The trial of Hasan serves as a reminder that American soldiers will remain squarely in the crosshairs of those few individuals in the United States who are motivated by al Qaeda's ideology.
But in the wake of the Fort Hood massacre, the Pentagon has made a concerted effort to identify and address the government failures that allowed Hasan to carry out his attack, making another "insider" attack on a military facility in the United States significantly less likely than it was four years ago.
Follow @CNNOpinion on Twitter.
Join us at Facebook/CNNOpinion.