A Cairo court on Tuesday ruled to allow Egyptian Bahais to leave their religion blank on official documents, in effect restoring their access to jobs, schools and medical and financial services.
The Court of Administrative Justice ruled in favour of two cases seeking to leave the religious affiliation field blank on official documents.
The first case involved a lawsuit by Rauf Hindi, who was seeking legal birth certificates for his 14-year-old twins, Imad and Nancy.
The second lawsuit was filed by Hussein Abdul Messih who was suspended by a university due to his inability to obtain a legal ID paper.
When the government announced five years ago that only Islam, Christianity and Judaism would be recognised as religions on the new compulsory electronic official papers, Bahais were left in legal limbo as they refused to choose between the three religions.
In Egypt, carrying identity papers at all times is required by law.
Without the official ID cards, Egyptians can not apply for jobs, buy property, open bank accounts or register their children in schools. They are also subject to arrest for not carrying valid identity papers.
The verdict is considered a compromise solution after an Egyptian court denied Bahais the right to state their religion on official documents in 2006.
Nonetheless it was welcomed as a victory for religious freedom.
"This is a welcome and significant decision and puts an end to the great injustice faced by citizens who have been victims of the government's arbitrary discrimination based solely on religious belief," said Hossam Bahgat, director of the Egyptian Initiative for Personal Rights.
"We call on the government to implement the decision without appeal or delay," he told AFP.
Bani Dugal, the Bahai community's representative at the United Nations, said the verdict should be cheered.
"Given the degree to which issues of religious freedom stand at the heart of human rights issues in the Middle East, the world should cheer at the decision in these two cases," she said in a statement.
"The compromise offered by the Bahais ... opens the door to a way to reconcile a government policy that was clearly incompatible with international law as well as common sense," she said.
"I can finally buy a car!" Ragi Labib, an Egyptian Bahai who has been without valid papers told AFP.
Bahais consider Bahaullah, born in 1817, the last prophet sent by God, while Muslims believe the last messenger of God was the Prophet Mohammed.
Bahaullah was banished and lived 40 years in exile. He died in 1892 and was buried in the Holy Land, close to what is now the northern Israeli port of Haifa.
Of the faith's 12 principles including the unity of mankind, the elimination of all forms of prejudice, gender equality and independent investigation of truth, it is obedience to government that is most highlighted in Egypt.
Egyptian Bahais do not join political parties, take part in demonstrations or hold elections for their spiritual assemblies.
In Iran on Tuesday, 54 Bahais, whose faith is banned in the Islamic republic, were convicted for anti-regime propaganda. Three of them were sentenced to four years in jail, while the rest received suspended terms.