WASHINGTON — An intercepted secret message between al-Qaida chief Ayman al-Zawahri and his deputy in Yemen about plans for a major terror attack was the trigger that set off the current shutdown of many U.S. embassies, two officials told The Associated Press on Monday.

A U.S. intelligence official and a Mideast diplomat said al-Zawahri’s message was picked up several weeks ago and appeared to initially target Yemeni interests. The threat was expanded to include American or other Western sites abroad, officials said, indicating the target could be a single embassy, a number of posts or some other site. Lawmakers have said it was a massive plot in the final stages, but they have offered no specifics.

The intelligence official said the message was sent to Nasser al-Wahishi, the head of the terror network’s organization, based in Yemen, known as al-Qaida in the Arabian Peninsula.

Both officials spoke on condition of anonymity because they were not authorized to discuss the sensitive issue publicly.

U.S. spies and intelligence analysts on Monday scoured email, phone calls and radio communications between al-Qaida operatives in Yemen and the organization’s senior leaders to determine the timing and targets of the planned attack.

The call from al-Zawahri, who took over for Osama bin Laden after U.S. Navy SEALs killed the al-Qaida leader in May 2011, led the Obama administration to close diplomatic posts from Mauritania on Africa’s west coast through the Middle East to Bangladesh, east of India, and as far south as Madagascar.

The U.S. decided to reopen some posts Monday, including well-defended embassies in Kabul and Baghdad.

Authorities in Yemen, meanwhile, released the names of 25 wanted al-Qaida suspects and said those people had been planning terrorist attacks targeting “foreign offices and organizations and Yemeni installations” in the capital Sanaa and other cities across the country.

The Yemeni government also went on high alert Monday, stepping up security at government facilities and checkpoints.

Officials in the U.S. wouldn’t say who intercepted the initial suspect communications — the CIA, the National Security Agency, the Defense Intelligence Agency or one of the other intelligence agencies — that kicked off the sweeping pre-emptive closure of U.S. facilities. But an intelligence official said the controversial NSA programs that gather data on American phone calls or track Internet communications with suspected terrorists played no part in detecting the initial tip. That official spoke on condition of anonymity because the official was not authorized to discuss the spying publicly.

A U.S. official familiar with the threat information said the decision to close the posts was based on a broad swath of information, not just the intercept. The official was not authorized to disclose the information and spoke on condition of anonymity.

The embassy closures were announced one day after President Obama met with Yemeni President Abdo Rabby Mansour Hadi.