Sayeed Zabiuddin Ansari, with his face covered, leaves from a hospital in New Delhi, on June 29, 2012. An alleged key plotter in the 2008 Mumbai attacks now in Indian police custody had been living in Saudi Arabia for two years. (Andan Abidi/Reuters)

For years, India watched helplessly as many of its most-wanted terrorism suspects traveled freely to Saudi Arabia from Pakistan with new identities and passports and without fear of arrest.

But things appear to have changed. Last week, Saudi Arabia deported an Indian accused of involvement in the terrorist attacks in Mumbai in 2008 that killed 166 people, including six Americans. At the same time, news came that Riyadh is likely to deport another accused terrorist to India in the next few weeks.

The shift in Saudi policy toward India is part of the kingdom’s broader foreign policy makeover since the Sept. 11, 2001, terrorist attacks on the United States, analysts say.

“This deportation is really a first, and it signals Saudi Arabia’s changing attitude toward India as much as it also signals the internal changes in Saudi society,” said K.C. Singh, a former Indian diplomat. “It coincides with India aligning itself with American interests and India’s cautious distancing from Iran.”

Saudi Arabia also gives India a gateway to the entire Arab region, where it has little influence, compared with Pakistan. Saudi Arabia can assist India in its quest for energy in the region, improve its access to trading partners and help it address radicalism among Indian Muslims who migrate to the Middle East for lucrative work.

Saudi Arabia has not exactly been India’s friend all these years. In fact, it has resolutely supported Pakistan on many matters, especially the long-standing dispute between India and Pakistan over the Himalayan province of Kashmir.

But the handover last week of Sayed Zabiuddin Ansari is deeply embarrassing for Pakistan because the evidence in his case points to the involvement of the Pakistani state in the Mumbai attacks, Indian officials said. On Thursday, Islamabad denied the charge.

Investigators said it was Zabiuddin’s voice that was heard from a control room in Pakistan guiding the 10 gunmen in Mumbai as they went about shooting people at a cafe, two five-star hotels, a train station and a Jewish prayer center. The FBI helped intercept the calls, officials said.

Zabiuddin, also known as Abu Jundal, later traveled to Saudi Arabia with a Pakistani passport and began raising funds there and recruiting men for future attacks, investigators said. The United States tracked him to the kingdom and alerted New Delhi and Riyadh, officials said.

“It is no longer safe for Indian terrorists living in Pakistan to travel to Saudi Arabia with new names and Pakistani passports,” said a senior intelligence officer who spoke on the condition of anonymity because he is not authorized to speak to the media. “Many of them go there routinely for the hajj pilgrimage and Islamic charity. Some also go to Saudi Arabia to enlist Indian laborers into their militant network.”

In May, police in Saudi Arabia detained another Indian, Fasih Mehmood, who is accused in India of being involved in a bomb blast outside a cricket stadium and an incident in which gunmen shot at foreign tourists outside a mosque in 2010.

India’s diplomatic ties with Riyadh began changing in 2006 after Saudi Arabia’s King Abdullah visited New Delhi. In 2010, the two nations signed several pacts, including agreements on energy, counterterrorism, narcotics, money laundering and extradition. A year ago, Riyadh agreed to double its oil exports to India, helping New Delhi reduce its reliance on Iran.

But the recent warmth and the deportation do not mean that Riyadh has turned away from Pakistan entirely, officials said.

“It doesn’t have implications for interstate relations between Pakistan and Saudi Arabia,” said Ali Sarwar Naqvi, a former Pakistani diplomat who heads the Center for International Strategic Studies in Islamabad, Pakistan’s capital. “It is not meant to cause embarrassment to Pakistan.”

Richard Leiby in Islamabad contributed to this report.