A man was jailed for 18 years Monday for planning to attack a military recruiting center with machine guns and grenades, as prosecutors thanked the local Muslim community for helping foil the plot.

Abu Khalid Abdul-Latif, 34, was also sentenced to 10 years of supervised release following his prison term after he pleaded guilty to the 2011 plot.

"This defendant planned to attack a military center when there would be the largest possible gathering of new recruits and their families," said US Attorney Jenny Durkan.

"He targeted young men and women solely because they wanted to serve our country. His goal: to inspire others with a message of hate," she added after his sentencing.

The FBI's Seattle office boss Laura Laughlin said: "Countless innocent people targeted by Mr. Abdul-Latif are safe thanks to the vigilance of Seattle's Muslim community and the dedicated work of law enforcement partners.

"The plot may have been thwarted, but its mere existence and the extremist thinking behind it are despicable," added the Federal Bureau of Investigation special agent in charge.

Abdul-Latif, also known as Joseph Anthony Davis, pleaded guilty in December to conspiracy to murder US federal employees and conspiracy to use weapons of mass destruction. He had faced up to 19 years in prison under a plea deal.

He "planned to use grenades and machine guns to attack recruits" at the base, in south Seattle, in June 2011, said the US Attorney's Office for the Western District of Washington.

Judge L. Robart said the plot "could have done incredible harm if it had gone forward."

In December 2011 a co-defendant in the case, 32-year-old Walli Mujahidh, pleaded guilty to plotting to attack the Military Entrance Processing Station (MEPS) in Seattle.

Police were alerted to the plot when a member of the public claimed to have been approached about participating in the attack and supplying firearms to the conspirators.

Agents began monitoring Abdul-Latif and Mujahidh, recording them on audio and video "discussing a violent assault" on the Seattle military center, where the US military screens and processes enlistees.

"His plot was disrupted by vigilance in our community and good work by law enforcement," said Durkan.

"I commend the Seattle Police and the FBI for their work, and thank the leaders of our Muslim communities who work tirelessly to ensure the acts of extremists are not used to condemn their faith."

Seattle Police Chief John Diaz said also lauded the Muslim community's help. "I am pleased with the outcome of this very important joint agency investigation.

"With support from the Muslim community and the diligent work of Seattle police detectives and our federal partners, a dangerous man will spend a long time behind bars and our community will be safer for it," he added.

Abdul Latif's co-conspirator Mujahidh, of Los Angeles, is scheduled for sentencing on April 8.