Two Bosnians were also convicted.
Bajro Ikanovic, 30, was sentenced to eight years for supplying them with explosives.
The fourth defendant, Senad Hasanovic, was sentenced to two-and-a-half years for illegal possession of weapons and explosives.
A fifth man pleaded guilty to charges related to the plot in June.
Police found a "suicide belt" rigged with a home-made explosive device together with pistols, ammunition and a videotape outlining how to build a bomb when they raided the apartment in Sarajevo in October 2005, prosecutors said.
The flat was rented by Bektasevic and Cesur.
A fifth man, Amir Bajric, a Bosnian, pleaded guilty in May and was sentenced in July to two years in prison for helping the group to buy explosives.
The two suspects with European passports had travelled to Bosnia "with the aim to commit a terrorist act on the territory of Bosnia-Herzegovina or some other European country", Ahmet Halebic, prosecuting, said during a hearing at Bosnia's state court in May.
The videotape found by police included a voiceover saying: "Brothers are preparing for an attack here. They are showing you the things they will use in the attack ... These brothers will attack ... those who are killing our brothers and Muslims in Iraq and Afghanistan."
The voiceover said the attack was aimed against Europe.
Investigators have not yet found out which country the men were plotting to attack and could say only that it was a European state with soldiers serving in Iraq and Afghanistan.