India has discontinued its two largest rupee notes in a shocking move against corruption.

Notes worth 500 and 1,000 rupees will be invalid starting at midnight local time, Prime Minister Narendra Modi announced during a televised address to the nation.

The unexpected move is designed to fight against corruption and money laundering, Modi said, calling them "diseases" and "obstacles" to the country's economic success.

Modi said that policy changes had largely failed to root out corruption. Two years ago, he said, India was ranked 100th in terms of global corruption perception, and the country has only improved to 76th.

Related: India's tax dodgers still hiding hundreds of billions

The idea is that Indians who have stockpiled undeclared income will now be forced to come out of the shadows.

"This step will strengthen the hands of the common man in the fight against corruption, black money and fake currency," said Modi, who leads the ruling Bharatiya Janata Party.

Brilliant Move by @PMOIndia on Demonetisation of current Rs.500 and Rs.1000 notes. Biggest Crackdown on BlackMoney in any Nation's History — ashutosh mishra (@ashutos76653335) November 8, 2016

But the ban could also spark a mad scramble as ordinary Indians seek to exchange or deposit their cash. Modi said citizens have 50 days to deposit at banks and post offices. Hospitals will be allowed to accept the banned notes for another three days, until Nov. 11.

That transition will not be an easy task. The Reserve Bank of India (RBI) estimates that there are 16.5 billion 500 rupee notes and 6.7 billion 1000 rupee notes currently in circulation. ATMs will be shut on Nov. 9 and 10 to help implement the change.

Related: India's new central banker serves up surprise interest rate cut

The central bank is also preparing to issue a new series of 500 and 2,000 rupee notes, which are slated to enter circulation by Nov. 10.

Until then, the largest legal bill in circulation will be the 100 rupee note, which is worth only $1.50.

RBI issues ₹2000 note in new series pic.twitter.com/7Ob2j1t6Ab — ReserveBankOfIndia (@RBI) November 8, 2016

In a country where taxi drivers and shopkeepers are already reluctant to part with small bills, the sudden policy change could complicate business transactions in the short term.

Indian social media users widely praised the decision, calling it a "bold move." There were also, inevitably, plenty of jokes.

Two Minutes Of Silence For People Who Are Standing In Queue At ATMs Right Now, Having No Clue About The Ban On Rs 500 And Rs 1000 Notes. ;) — Sir Ravindra Jadeja (@SirJadeja) November 8, 2016

Don't worry folks.. winter is coming.. people with rs 500 and rs 1000 notes black money can burn it and stay warm.#IndiaAgainstCorruption — Shrinidhi (@_shrinidhi_) November 8, 2016

India is believed to have lost out on over $100 billion in uncollected tax, a large percentage of which is illegally stashed offshore.

Only 2% of Indians pay any income tax at all because most people work in the economy's informal sector that includes jobs such as construction laborers and road side food sellers.

Modi also touted the move as an anti-terrorism measure, saying that "enemies across the border have run their operations using fake currency notes," a reference to neighboring Pakistan.

"The 500 and 1,000 rupee notes hoarded by anti-national and anti-social elements will become just worthless pieces of paper," he said.