Scientists excavating fossil bones from an ancient seabed in Egypt have found the first evidence that primitive whales had functional legs, complete with kneecaps, ankles and little toes, according to research published today.

Researchers have long suspected ancient whales once had legs. Even today, whales retain tiny hind legs, but they serve no purpose and are contained completely within the body. The forelimbs of modern whales have evolved into flippers.

The discovery of finely preserved fossil legs fills in an important missing link in the evolution of whales. "It's big news," said Clayton Ray, curator and paleontologist at the Smithsonian Natural History Museum.

What the two-foot legs were used for, however, is still not clear. They may have provided for locomotion or they could have been used as "reproductive guides" to help orient the whales during copulation.

"A big whale with a body like a serpent whose reproductive organs were some 40 feet behind its brain probably could have used some help," said Philip Gingerich of the University of Michigan, who unearthed the fossilized whales from the Egyptian desert.

Most researchers agree the earliest whales descended from a line of large carnivorous beasts the size of wolves and bears. These furry land mammals, known as mesonychids, ran around on four legs. But for unknown reasons, some mesonychids evolved into forms that returned to the sea, from which all life originally arose. The legs found on primitive whales are remnants from their time on land.

The 40-million-year-old fossil whales were found in the windswept Zeuglodon Valley about 100 miles southwest of Cairo by Gingerich and his colleagues, Holly Smith of Michigan and Elwyn Simons of Duke University. Their report appears in today's issue of the journal Science.

"It's just an amazing site," Gingerich said. His team uncovered a "whale graveyard" with 243 skeletons of a primitive whale known as Basilosaurus isis, named the "king lizard" by scientists in the last century who mistakenly believed the creature was a reptile. Later, researchers realized these king lizards were in fact warm-blooded early whales.

The ancient whales had front flippers, little hind legs, big gnashing teeth and serpentine bodies 50 feet long, about the size of today's sperm whale. Ray said the creatures must have looked like "giant sea monsters."

The valley where the whales were found was once part of the ancient Tethys Sea, which shrunk to become today's comparatively puny Mediterranean. Gingerich said the whales lived in shallow salty waters that were probably no deeper than 20 feet. The habitat was rimmed with mangrove reefs. There is also fossil evidence of sea grass, sea snakes and smaller whale species.

The primitive whales ate fish. Like modern whales, the creatures had to come to the surface to breathe. But instead of possessing blowholes like modern whales and dolphins, the ancient whale had a nose that was about one-third of the way up its snout. As whales evolved over millions of years, the nose kept moving back until it became today's blowhole.

Scientists disagree on what purpose the hind legs may have served. Gingerich originally suspected they served as "sexual claspers" that would have held the whales together during copulation. He now believes "clasper" to be too strong a word. "The legs might have served as guides to help the whales orient themselves for reproductive purposes. It's just speculation, but the legs were fully functional and well-muscled. They served some purpose. We're just not sure what," Gingerich said.

Another expert in fossil whales disagreed about the sexual role of the hind legs. Lawrence Barnes, curator of vertebrate paleontology at the Natural History Museum of Los Angeles County, said the legs could have been used for propulsion.

"They were big guys. I could imagine if they got themselves into the shallows or mud flats, they could have used these limbs like a salamander and dragged themselves away," Barnes said.

Barnes said it is also possible the early whales used their stumpy legs to haul themselves onto shore, like sea lions, to give birth or sleep or mate.

Barnes and Gingerich and their colleagues are now hunting for other intermediate forms that would show how land-dwelling mammals evolved into sea-going whales. "We hope to close the circle," Barnes said.