WASHINGTON -- Indian Prime Minister Narendra Modi's BJP party recently scored victories in two state-level elections, retaining control in Gujarat and muscling out the rival Congress Party in Himachal Pradesh.

Gujarat may be Modi's home state and the BJP's margin over its rivals might have narrowed, but the two victories are good indicators that the prime minister continues to enjoy nationwide popularity.

A survey conducted by the Pew Research Center this past spring illustrates many of the reasons Modi was able to claim victory in both votes.

Three years after he assumed office, nearly nine-in-ten Indian adults held a favorable opinion of Modi, according to the survey. Support was not only broad, but deep; roughly seven-in-ten Indians said they had a "very favorable" view of the prime minister, a situation similar to 2015.

The prime minister was by far the most popular national political figure tested in the survey. His "favorable" rating was 30 points higher than that of Rahul Gandhi, the new leader of the opposition Congress Party.

The public's positive assessment has been buoyed by growing contentment with the economy. More than eight-in-ten said economic conditions are good, up 19 percentage points since immediately before the 2014 election. And the share of adults who said the economy is "very good," 30%, had tripled from three years ago. Moreover, Indians overwhelmingly believed that when their children grew up, they would be better off financially than their parents -- 76% said this.

Overall, seven-in-ten Indians were satisfied with the way things were going in the country. This positive assessment of the direction the country is taking had nearly doubled from 2014.

The public appears to continue to trust that the government is doing the right thing for the country, a fact that may have contributed to BJP victories in both Gujarat and Himachal Pradesh. More than eight-in-ten, 85% to be precise, expressed confidence in the national government.

Many Indians said they believed Modi has a handle on the country's main challenges -- 73% said a lack of employment opportunities is a "very big problem." A comparable share of the public, 72%, approved of the prime minister's handling of the issue, up 10 points from 2016.

Similar proportions of the public, 74% and 76%, respectively, cited corrupt officials and terrorism as very big challenges, and roughly seven-in-ten approved of how Modi had dealt with each. Public approval of his handling of corruption was up 11 points on 2016, while support for his response to terrorism was up 10 points.

The public gave Modi much lower marks on his handling of relations with Pakistan. Roughly one-in-five approved of the prime minister's approach to the neighboring country. Intense public disapproval of Pakistan itself had intensified, the proportion of "very unfavorable" opinions had risen from 55% in 2016 to 64% this past spring. And when it came to Jammu and Kashmir, long a source of tension between the two countries, 63% of Indians believed the government should rely more on military force to resolve the situation.

Along with continued backing for Modi, Indians were generally content with the current political system. Roughly eight-in-ten, 79%, were quite satisfied with the way democracy is working in the country.

Yet, 65% conceded that rule by nonelected experts would be a good way to govern the country. More than half of the public saw merit in a strong leader who would be free to make decisions without interference from parliament or the courts, while 53% even approved of military rule.

Support for autocratic rule was higher in India than in any of the other 37 countries surveyed. Similarly, India was one of only four countries where half or more of the public supported the idea of a military government.

Indians may be largely committed to Modi, but his ratings on foreign affairs, especially relations with Pakistan, indicated that the PM does not always speak for a majority of Indians. So far, Modi's widespread support would seem to align with the public's sense that democracy is working well in India. However, the fact that Indians also see merit in less democratic forms of government may mean future elections have as much to say about the health of India's democracy, as they do about Modi's popularity.

Bruce Stokes is director of global economic attitudes at the Pew Research Center.