WASHINGTON — A decade after hijackers mostly from Saudi Arabia attacked the United States with passenger jets, the Saudis have emerged as the principal ally of the U.S. against al-Qaida’s spinoff group in Yemen and at least twice have disrupted plots to explode sophisticated bombs aboard airlines.

Details emerging about the latest unraveled plot revealed that a Saudi double agent fooled the terror group, known as al-Qaida in the Arabian Peninsula, passing himself off as an eager would-be suicide bomber.

Instead, he secretly turned over the group’s most up-to-date underwear bomb to Saudi Arabia, which gave it to the CIA.

Before he was whisked to safety, the spy provided intelligence that helped the CIA kill al-Qaida’s senior operations leader — Fahd al-Quso — who was killed in a drone strike last weekend.

The role of Saudi Arabia disrupting the plot followed warnings in 2010 from the oil-rich kingdom about a plot to blow up cargo planes inside the U.S., either on runways or over American cities.

That plot involved a frantic chase across five countries of two packages containing bombs powerful enough to down an airplane.

Twice, a bomb was aboard a passenger plane. Once, authorities were just minutes too late to stop a cargo jet with a bomb from departing for its next destination.

Ultimately, no one died and the packages never exploded.

It hasn’t always been this way.

Saudi Arabia, the one-time home of Osama bin Laden, failed to spot and stop the 15 Saudi-born hijackers of the 19 who carried out the September 2001 terror attacks.

Questions remain whether two Saudi citizens who had at least indirect links with two of the hijackers were reporting to Saudi government officials.

U.S. law enforcement officials accused the Saudi government of failing to help adequately in investigations of the al-Qaida attack on the Navy ship Cole in Yemen in 2000 and Hezbollah’s bombing of the Khobar Towers housing complex, which killed 19 U.S. servicemen in 1996.

A series of devastating al-Qaida strikes against Saudi targets in 2003 and, more recently, fears that al-Qaida could try to trigger Arab-Spring-style revolts in the kingdom, has energized the Saudi government in its war against al-Qaida’s spinoff in Yemen, which is composed mostly of ex-Saudi militants.

Saudi Arabia and the U.S. have joined forces to penetrate the terror group at the highest levels.