The ibis and the kiwi are dogged diggers, probing in sand and soil for worms and other buried prey. Sandpipers, too, can be seen along the shore excavating small creatures with their beaks. It was long thought that these birds were using trial and error to find their prey.

But then scientists discovered something far more peculiar: Their beaks are threaded with cells that can detect vibrations traveling through the ground.

Some birds can feel the movements of their distant quarry directly, while others pick up on waves bouncing off buried shells — echolocating like a dolphin or a bat, in essence, through the earth.

There's one more odd detail in this story of birds' unusual senses: Ostriches and emus, birds that most definitely do not hunt this way, have beaks with a similar interior structure. They are honeycombed with pits for these cells, though the cells themselves are missing.

Now, scientists in a study published in Proceedings of the Royal Society B report that prehistoric bird ancestors dating nearly as far back as the dinosaurs most likely were capable of sensing vibrations with their beaks.

The birds that use this remote sensing today are not closely related to one another, said Carla du Toit, a graduate student at the University of Cape Town in South Africa and an author of the paper. That made her and her co-authors curious about when exactly this ability evolved, and whether ostriches, which are close relatives of kiwis, had an ancestor that used this sensory ability.

"We had a look to see if we could find fossils of early birds from that group," du Toit said. "And we're very lucky."

There are very well-preserved fossils of birds called lithornithids dating from just after the event that drove nonavian dinosaurs to extinction.

First they had to gather data on the beaks of more than 50 bird species so that they would be able to say how similar or different the fossil birds were to modern birds.

The team recorded the number of pits in the bone of the beak and the size of the beak and the head, important details because birds that dig for their food have a characteristic shape.

Then they took a look at the lithornithids. And indeed, the ancient beaks and head structure were extremely similar to the beaks of kiwis, ibises and sandpipers, far closer than any other bird in the study.

"It seems that they have this organ and were able to use the sense of remote touch to probe and locate prey as well, which is really cool, because it just shows that this is really old," du Toit said.

That means that the ancestors of ostriches and emus lost the ability sometime after the lithornithids lived, leaving them with only traces in their bone structure of this lost talent. They lack as well the enlarged brain regions that kiwis, ibises and shorebirds devote to processing the sensory information pouring in from the beak.

Du Toit and her colleagues are now studying the hadeda ibis, a South African bird that uses remote sensing, to see just how far away it can sense hidden objects — perhaps buried as much as 8 inches below the surface.