Police have detained several hundred protesters in some of India’s biggest cities as they defied a ban on assembly imposed to stop demonstrations against a new citizenship law.

Opponents of the law say it threatens the country’s secular democracy.

Dozens of demonstrations were planned around the country as opposition widened to the law, which excludes Muslims.

A protestor shouts slogans after being detained by police in Hyderabad. Credit: AP

The legislation has sparked anger at what many see as the Hindu nationalist-led government’s push to bring India closer to a Hindu state.

Historian Ramchandra Guha, a biographer of independence leader Mohandas Gandhi, was among those detained in Bangalore, the capital of southern Karnataka state.

The state government issued a ban on groups of more than four people gathering.

In New Delhi, Yogendra Yadav, the chief of the Swaraj India party, was among those detained as protesters demonstrated at New Delhi’s iconic Red Fort and the surrounding historic district.

Officials said more than 100 people were detained at the fort.

Protesters believe that Muslims face being detained or deported as a result of the law. Credit: AP

The main roads leading to the fort were blocked off and police did not let pedestrians go to nearby temples or shopping areas.

Internet and phone services were blocked around the fort and in some other parts of New Delhi, a tactic Indian authorities use in other parts of the country, such as disputed Kashmir, to try to stop people from organising protests. The measure, however, is rarely used in the capital.

The new citizenship law applies to Hindus, Christians and other religious minorities who are in India illegally but can demonstrate religious persecution in Muslim-majority Bangladesh, Pakistan and Afghanistan. It does not apply to Muslims.

Critics say it is the latest effort by prime minister Narendra Modi’s Hindu nationalist-led government to marginalise India’s 200 million Muslims, and a violation of the country’s secular constitution.

Mr Modi has defended it as a humanitarian gesture.

Officials have said the new law is a humanitarian gesture which protects refugees. Credit: AP

The law’s enactment last week follows a contentious process in the north-eastern Assam state, intended to weed out people who entered illegally.

Nearly two million people in Assam were excluded from an official list of citizens, about half Hindu and half Muslim, and have been asked to prove their citizenship or else be considered foreign.

India is also building a detention centre for some of the tens of thousands of people the courts are expected to ultimately determine have entered illegally.

Mr Modi’s interior minister, Amit Shah, has pledged to roll out the process nationwide.

Some Muslims fear it is a way for Hindu nationalists to detain them or deport them from the country.

On Wednesday, authorities tightened restrictions on protesters, expanding a blockade of the internet and a curfew in Assam.