The National Security Ministry foiled a radical Islamic group's plot to carry out a "large-scale horrifying terror attack" against government structures and diplomatic missions in Baku, the Azerbaijan capital.
It said that one suspect was killed and several others were detained in a weekend sweep outside the capital.
The British Embassy in Baku closed temporarily and the U.S. Embassy scaled back its operations in response to the threat.
The ministry said in a statement that the radical Islamic group included an army lieutenant who had stolen 20 hand grenades, a machine gun, four assault rifles and ammunition from his military unit and made them available for the planned attack.
Security forces tracked down the group and arrested several of its members during a sweep Saturday in the village of Mastaga about 30 kilometers (20 miles) northeast of Baku. One member of the group offered resistance to the arrest and was killed, the statement said.
The ministry said that a hunt for other members of the group was still under way.