NEW DELHI — General elections in India will begin on April 11, officials announced on Sunday, with some 900 million voters eligible to cast ballots to fill parliamentary seats and choose the next prime minister in the world’s largest democracy.

The elections, which will be held during a period of heightened nationalism in India, are a crucial test for the governing center-right Bharatiya Janata Party, or B.J.P., and for Prime Minister Narendra Modi, who is running for a second five-year term.

Many analysts say that Mr. Modi’s image — recently dented by slowing economic growth and allegations that the governing party had suppressed a report showing a 45-year high in unemployment — has recovered since a military confrontation between India and Pakistan, and has perhaps even strengthened ahead of the vote.

Amid growing fears worldwide about the power of social media to manipulate voters, India’s election commission said it would closely monitor platforms like Facebook.

The chief election commissioner, Sunil Arora, said voting would be held in seven stages, staggered across the country, before polls closed on May 19. Ballot counting will begin on May 23 and is expected to be completed in a day.

Voters will effectively choose India’s next leader by filling more than 500 seats in the lower house of Parliament, the Lok Sabha.

Next month’s elections are largely a contest between the B.J.P. and the Indian National Congress, the party of Mohandas K. Gandhi, which has led India for most of the country’s post-independence history. The vote will be the B.J.P.’s to lose, analysts said.

In the aftermath of the recent military confrontation between India and Pakistan, Mr. Modi has tapped into an intense nationalist current running through the country.