KANSAS CITY, Mo. - Here's an idea for a science fiction thriller: A virulent, mutating fungus capable of killing most of the world's wheat crop begins to spread, threatening famine and economic havoc. Scientists work feverishly to find genes for new varieties of wheat that can resist the fungus and avert disaster.

Actually, that isn't a movie plot. It is really happening.

The fungus is called wheat stem rust, and the most virulent strain of it to appear in a century is devastating the wheat crops in a few countries. Although it has not hit any major producers and could be years away from the U.S., more than 80 percent of the world's wheat crops appear to be vulnerable to it.

Where it has taken hold, the fungus is overwhelming most of the genetic defenses bred into the plants over the decades. And it continues to mutate, becoming even more dangerous.

The threat, which has been building for years, took on new urgency when it crossed into Yemen and last year into Iran, opening potential pathways into some major wheat-producing countries. That put even more pressure on international work already under way to combat the fungus. Kansas State University is playing a major role in the effort.

The fungus, known as Ug99, appeared first in Uganda in 1999 and has so far spread to a handful of countries, including Yemen, Kenya, Iran and Ethiopia. A concern is that the fungus, which is spread by the wind, will begin to move at a far faster pace into more countries.

It could next enter Pakistan and India, the world's second largest wheat producer, with other major wheat producers also endangered, including Russia and China. The United States, the world's third-largest wheat producer, is eventually expected to be hit as well, although it could be years before that occurs.

"It is just a matter of time before it spreads all over the world," said Bikram Gill, the head of Kansas State University's Wheat Genetics Resource Center. "If it would come here tomorrow, it would be disaster."

Fungicides offer some protection, but the most fruitful approach is in producing new varieties of wheat resistant to Ug99. Kansas State has already found some genes that promise to do that, but it takes years to breed a new wheat variety and produce sufficient seed for widespread production.

Wheat is called the staff of life for a reason. It is a basic food in most societies, and a shortage would have a profound impact, including potentially causing riots and famine. The United Nations has encouraged the effort to combat Ug99, saying the fungus endangers the world's food security.

The economic impact would be serious as well. Kansas, the top wheat-producing state, last year harvested wheat worth $2.5 billion, with half of the crop exported. A 2006 study found wheat responsible for 206,000 jobs in the United States.

Joe Kejr, taking a break last week from harvesting wheat at his family's farm near Brookville, Kan., said the problem had gotten more attention in the past year. It's no longer considered a question of if but when the fungus reaches the U.S., he said, so he hopes there will be several years to prepare for it.

"The question is whether there is really enough money for the cause," said Kejr, who is past president of the Kansas Association of Wheat Growers.

The effort has received some government help, and it got a big push when the Bill and Melinda Gates Foundation encouraged Cornell University to develop a plan for Ug99. Cornell's recommendations included research, accelerated plant breeding and global coordination of efforts. The foundation gave $26.8 million to get the plan moving.

As a result, the Durable Rust Resistance in Wheat project launched in April 2008. It is led by Cornell, which enlisted more than a dozen institutions around the world. Kansas State, which has an international reputation in wheat genetics, was a natural to be included.

The project aims to deploy as quickly as possible some genetically resistant varieties of wheat and then add others.

Michael Pumphrey, a U.S. Agriculture Department research geneticist who works at Kansas State, recently got a call from Cornell to be one of the project's five team leaders and to coordinate international efforts. Researchers there were already at work seeking fungus-resistant genes.

Pumphrey and others have an appreciation of just how tough an adversary Ug99 is. Several varieties of wheat planted in the Great Plains had some resistance to Ug99, but the fungus has since mutated in a way that would make those varieties vulnerable if Ug99 reached the United States.

But researchers at Kansas State and elsewhere are finding other genes that should give wheat resistance to the fungus. Wild relatives of wheat yielded some of the genes, and plant breeders have started to develop new wheat varieties.

"We're making advances," Pumphrey said.

However, the ability of the fungus to mutate means more genes need to be found to give wheat the protection it will need against Ug99.

One indication that the scientists know their work is far from over: The Durable Rust Resistance in Wheat project is working on a five-year plan.

"This is a race between the fungus and the scientists," Gill said.