FBI officials say the men have been under surveillance since 2006, and that neither was seriously planning an attack.

"The arrests do not relate to any known immediate threat to the public or active plot against the United States," the US attorney's office said in a statement.

The FBI and local police offered no further details on the investigation.

Alessa and Almonte are scheduled to appear in US federal court in New Jersey on Monday for an arraignment.

Shabab has been fighting a war against Somalia's government. It claims an ideological affiliation with al-Qaeda, and is designated a terrorist organisation by the US state department, but its activities have been largely limited to Somalia.