India's parliament has passed a bill which offers amnesty to non-Muslim illegal immigrants from three neighbouring countries.
The bill provides citizenship to religious minorities from Pakistan, Bangladesh and Afghanistan.
The government, led by the Hindu nationalist Bharatiya Janata Party (BJP), says this will give sanctuary to people fleeing religious persecution.
Critics say the bill is part of a BJP agenda to marginalise Muslims.
The Citizenship Amendment Bill (CAB) passed the upper house of parliament, where the BJP lacks a majority, by 125 votes to 105 on 11 December. It had cleared the lower house two days earlier.
The bill has already prompted widespread protests in the north-east of the country which borders Bangladesh, as many people there say they will be "overrun" by immigrants from across the border.
What does the bill say?
The CAB amends the 64-year-old Indian Citizenship law, which currently prohibits illegal migrants from becoming Indian citizens.
It defines illegal immigrants as foreigners who enter India without a valid passport or travel documents, or stay beyond the permitted time. Illegal immigrants can be deported or jailed.
The new bill also amends a provision which says a person must have lived in India or worked for the federal government for at least 11 years before they can apply for citizenship.
Now there will be an exception for members of six religious minority communities - Hindu, Sikh, Buddhist, Jain, Parsi and Christian - if they can prove that they are from Pakistan, Afghanistan or Bangladesh. They will only have to live or work in India for six years to be eligible for citizenship by naturalisation, the process by which a non-citizen acquires the citizenship or nationality of that country.
It also says people holding Overseas Citizen of India (OCI) cards - an immigration status permitting a foreign citizen of Indian origin to live and work in India indefinitely - can lose their status if they violate local laws for major and minor offences and violations.
Why is the bill controversial?
Opponents of the bill say it is exclusionary and violates the secular principles enshrined in the constitution. They say faith cannot be made a condition of citizenship.
The constitution prohibits religious discrimination against its citizens, and guarantees all persons equality before the law and equal protection of the law.
Delhi-based lawyer Gautam Bhatia says that by dividing alleged migrants into Muslims and non-Muslims, the bill "explicitly and blatantly seeks to enshrine religious discrimination into law, contrary to our long-standing, secular constitutional ethos".
Historian Mukul Kesavan says the bill is "couched in the language of refuge and seemingly directed at foreigners, but its main purpose is the delegitimisation of Muslims' citizenship".
Critics say that if it is genuinely aimed at protecting minorities, the bill should have have included Muslim religious minorities who have faced persecution in their own countries - Ahmadis in Pakistan and Rohingyas in Myanmar, for example. (The government has gone to the Supreme Court seeking to deport Rohingya refugees from India.)
Defending the bill, senior BJP leader Ram Madhav said, "no country in the world accepts illegal migration".
"For all others about whom the bleeding hearts are complaining, Indian citizenship laws are there. Naturalised citizenship is an option for others who legally claim Indian citizenship. All other illegal [immigrants] will be infiltrators," he added.
Also defending the bill earlier this year, R Jagannathan, editorial director of Swarajya magazine, wrote that "the exclusion of Muslims from the ambit of the bill's coverage flows from the obvious reality that the three countries are Islamist ones, either as stated in their own constitutions, or because of the actions of militant Islamists, who target the minorities for conversion or harassment".
What is the history of the bill?
The Citizen Amendment Bill was first put before parliament in July 2016.
The legislation cleared parliament's lower house where the BJP has a large majority, but it did not pass in the upper house, after violent anti-migrant protests in north-eastern India.
The protests were particularly vocal in Assam state, which in August saw two million residents left off a citizens' register. Illegal migration from Bangladesh has long been a concern in the state.
The CAB is seen as being linked to the register, although it is not the same thing.
The National Register of Citizens (NRC) is a list of people who can prove they came to the state by 24 March 1971, a day before neighbouring Bangladesh became an independent country.
In the run-up to its publication, the BJP had supported the NRC, but changed tack days before the final list was published, saying it was error-ridden.
The reason for that was a lot of Bengali Hindus - a strong voter base for the BJP - were also left out of the list, and would possibly become illegal immigrants.
How is the citizens' register linked to the bill?
The two are closely linked, because the Citizenship Amendment Bill will help protect non-Muslims who are excluded from the register and face the threat of deportation or internment.
This means tens of thousands of Bengali Hindu migrants who were not included in the NRC can still get citizenship to stay on in Assam state.
Later, Home Minister Amit Shah proposed a nationwide register of citizens to ensure that "each and every infiltrator is identified and expelled from India" by 2024.
"If the government goes ahead with its plan of implementing the nationwide NRC, then those who find themselves excluded from it will be divided into two categories: (predominantly) Muslims, who will now be deemed illegal migrants, and all others, who would have been deemed illegal migrants, but are now immunised by the Citizenship Amendment Bill if they can show that their country of origin is Afghanistan, Bangladesh or Pakistan," Mr Bhatia said.
Taken together, the NRC and CAB have the "potential of transforming India into a majoritarian polity with gradations of citizenship rights," said sociologist Niraja Gopal Jaya.