An aide to Yemen's former president Ali Abdullah Saleh said on Thursday his security team had uncovered a plot to kill him with explosives planted in a tunnel running to a mosque inside his residential compound in Sanaa.

Yemen's authorities said they were investigating.

Saleh, who stepped down in 2012 amid mass protests against his rule after more than three decades in office, remains an influential figure in the country and still has many enemies.

He has survived at least two assassination attempts, the latest in June 2011 when he sustained serious burns and several senior officials and aides were killed.

Abdullah al-Mughrabi, Saleh's private secretary, said the plot came to light following a tip-off to his security guards from one of the people involved in digging the tunnel.

“Initial investigations showed that the tunneling began four months ago and its purpose was to assassinate the former president and his aides,” Mughrabi told Reuters.

“The tunnel had reached under a small mosque at the house which is used by the former president and top leaders of his political party.”

Mughrabi said Saleh's security went to inspect the tunnel and detained five people on the spot. Three of them were handed to Yemen's top security team, a committee headed by the minister of interior.

An interior ministry official confirmed that three suspects had been turned over to the authorities by Saleh's security team and said others were being sought for questioning, but declined to give further details.

Saleh retains the post of head of the General People's Congress, the former ruling party and a main partner in the coalition government that was set up after he stepped aside.

His departure under a Gulf-brokered power transfer deal in which his deputy, Abd-Rabbu Mansour Hadi, succeeded him, was accompanied by bitter disputes, including over his being granted immunity from prosecution by parliament.

Critics say the former president abused his office for personal gain and must stand trial for it. Saleh has denied any wrongdoing.

The U.N. Security Council passed a resolution in February authorizing sanctions against specific individuals who obstructed the country's political transition or committed human rights violations.

Yemen's central government is struggling to restore its authority after several years of political upheaval and insecurity.

Washington has a stake in stability in Yemen, where Islamist militants have plotted attacks against international airlines, because the country shares a long and porous border with the world's top oil exporter, Saudi Arabia.