India’s diplomatic outreach to bring home 46 nurses as well as help thousands of other Indians in Iraq leave the violence-torn country was steered by National Security Adviser Ajit Doval and Intelligence Bureau Director Asif Ibrahim, who flew to Baghdad and Riyadh respectively last month, The Hindu has confirmed.

Their missions, which were kept secret at the time, were powered by phone calls from External Affairs Sushma Swaraj to her counterparts in the region.

At the end of June, the situation for both the 46 nurses in Tikrit as well as 39 men in Mosul seemed bleak, with no real intelligence on rebel groups that were in charge of them and why they were being forcibly held. The ISIS had taken control of several cities, including Tikrit, Mosul and the Baiji refinery.

At places, they were assisted by Ba’athist groups still loyal to the residual regime of Saddam Hussein, and rebel military commanders from the Iraqi army, who held areas in a loose tactical coalition as ISIS, which made it even more difficult to open clear lines of communication.

Faced with a grim situation, Prime Minister Narendra Modi asked Mr. Doval to convene a high-level meeting to discuss the latest intelligence on the fighting in Tikrit and Mosul, as well as the possibilities for a mass evacuation of “all Indians in Iraq, if necessary.” A day after the meeting, on June 25, Mr. Doval went on a top secret mission to Iraq to understand the position on the ground and make high-level contacts in the Iraqi government.

Since the conflict zone in Iraq is held mainly by Sunni insurgents and militant groups, Mr. Ibrahim was dispatched to Riyadh on June 25-26 to speak with senior officials about intelligence on these groups.