They may have expelled them centuries ago, but a large number of Spaniards still conserve the imprint of their country's Jews and Muslims in their genes, scientists have discovered.

Almost one in three Spaniards carry traces of the Jews who were told to leave or convert to Christianity at the end of the 15th century or the Muslim Moors who followed them into exile a century later.

The study by scientists from European universities found that despite the attempts at ethnic cleansing, one in 10 Spanish men bore evidence of north African, and presumably Moorish, forebears in their DNA.

That number almost doubled when they tested for DNA traces that pointed to a Sephardi ancestor. The Sephardis were Jews with family origins in the Iberian Penisula.

"These proportions attest to a high level of religious conversion (whether voluntary or enforced), driven by historical episodes of social and religious intolerance," the scientists explain in the American Journal of Human Genetics.

Spain's Jews were thrown out in 1492 on the orders of Queen Isabella and King Ferdinand, who gave them the option of staying and converting to Christianity.

The genetic study appears to show that many chose the second option. Those who converted were subjected to close scrutiny by the Spanish Inquisition, which spent much of its time trying to root out secret Jews.

One secret community has survived until today in the Portuguese town of Belmonte. Portugal, which was included in the pan-Iberian study, expelled its Jews shortly after Spain.

The study pointed to a smaller number of Spanish Muslims who converted and remained behind after they were told to leave in 1609.

"An unexpected result was that we found more north African influence in the west then in the east of the peninsula," said Elena Bosch, of Spain's Pompeu Fabra university.

That meant the Moorish influence survived more strongly in the first areas to be reconquered by Christians during the seven centuries in which Spain was divided between Christian and Muslim kingdoms.

It pointed to more conversion and cross-marriage amongst those Muslims, known as moriscos, who lived in Christian kingdoms.

The researchers suggested it reflected the enforced movement of Muslims from the south-eastern region of Granada when this, the last Moorish kingdom, was conquered in 1492.

Researchers said their study was an attempt to apply genetic analysis to a relatively recent period of history. Most scientific studies of the genetic origins of populations have looked back towards prehistory.