German police are searching flats in a Cologne tower block where a Tunisian man is suspected of having kept highly toxic ricin.
The 29-year-old man, named in German media only as Sief Allah H, is being questioned by police.
Police stormed his flat on Tuesday and found a chemical which turned out to be ricin. He is suspected of planning a biological terror attack.
Ricin is a poison found naturally in castor beans.
German security sources quoted by RP news, which is based in the Cologne region, said the quantity of ricin found was enough for up to 1,000 toxic doses.
Police have sealed off the apartment block in Cologne-Chorweiler district. They are searching two flats rented by the suspect, as well as six other empty flats and some public areas in the building.
The authorities say there is no immediate danger to the other residents.
Experts from the Robert Koch Institute - a prestigious scientific research centre - are with police at the scene.
Germany's top constitutional protection official, Hans-Georg Maassen, said it was "very probable that a terror attack was foiled here".
German media report that the suspect was investigated after he had bought 1,000 castor seeds - commonly called "beans" - and an electric coffee grinder on the internet.
Ricin can be made from waste left over from processing castor beans, the US Centers for Disease Control (CDC) says. It can take the form of powder, a mist, or a pellet, or it can be dissolved in water or weak acid.
Ricin made headlines internationally when it was found to have killed a Bulgarian dissident, Georgi Markov, in an infamous umbrella stabbing in London during the Cold War.
The exiled writer and BBC journalist, an opponent of Bulgaria's then-Communist government, was stabbed in the thigh in 1978. Later a tiny 1.7mm platinum pellet with a ricin-filled cavity was found in his body.
What does ricin do?
There is no antidote to ricin poisoning. Because of its high toxicity it is listed among biological weapons.
Tiny doses can be fatal if administered by injection or inhaled as a powder.
In the bloodstream, ricin is rapidly taken up by cells, inhibiting protein synthesis and killing them.
The early symptoms of ricin poisoning are vomiting and diarrhoea. The best emergency treatment is stomach-pumping and intravenous fluids to counter dehydration. Medical charcoal can also absorb the poison in the gut.
Death can result within three days, after painful internal bleeding and organ failure, a blog on the Kew Gardens website says.
What about castor oil?
Ricin is not soluble in oil - it is separated off in the waste "mash" when castor oil is made.
The oil is mass-produced in China and India - up to 500,000 tonnes per year - and has a variety of uses, including as a laxative and an engine lubricant. Castor oil goes into paints, cosmetics and plastics, among other things.
The beans come from a tropical plant, Ricinus communis, widely available in garden centres.