Indians crowd a gas station, one of the few places still accepting 500- and 1,000-rupee notes in New Delhi on Tuesday evening. (Manish Swarup/AP)

In an ambitious move to crack down on illicit money, India announced Tuesday that existing large-currency bills will no longer be valid, starting at midnight.

Curbing the prevalence of illegal and unaccounted wealth was a key campaign pledge of Prime Minister Narendra Modi, who came to power two years ago.

“We have decided that currency notes of 500 and 1,000 Indian rupees will not be acceptable for transaction from midnight onwards,” Modi said in a televised address. A thousand Indian rupees is worth about $15.

Modi said the target is terrorism financing and corruption. “In the last few years, the specter of corruption and black money has grown,” he said. “Have we ever thought about how the terrorists get their money? They are using fake currency. On the one hand, the threat of terrorism, on the other hand, the challenge posed by corruption and black money.”

Citizens have 50 days to exchange their old bills for new ones. But banks will be closed Wednesday, and ATMs will be closed until Friday.

Minutes after Modi’s address, panic-stricken crowds thronged bank machines.

“What will I do in the next two days? I have no small bills with me,” said Brajesh Kumar, as he pulled out a wad of cash. “This is all too sudden.”

Even with the growth of credit cards, Indians routinely use cash. About 30 percent of all land transactions involve cash, analysts say, and land is the preferred parking place for politicians, business executives and movie stars seeking to hide illegal money.

Between 2011 and 2016, circulation of 500-rupee notes increased by 76 percent and 1,000-rupee notes by 109 percent, according to the government.

Total “black money” hidden in India and overseas is estimated at $400 billion to more than $1 trillion.

“You cannot have a shadow economy representing a substantial percentage of the real economy,” said Shaktikanta Das, secretary of the Department of Economic Affairs.

Last year, the government urged Indians to voluntarily disclose illegal wealth stashed in foreign bank accounts.

“It was one thing to bring back black money from banks abroad. But we always knew that the bigger problem is the black money inside the domestic economy. This was always the more difficult step,” said Gurcharan Das, a business historian and columnist.

“The banks will now keep a record of how much old cash you are bringing,” he said. “They will now have a way to track the cash and tax later. This is the largest strike against black money.”