Ahmad, intelligence chief Ali Hassan al-Ahmadi and military police chief Awad Majwar al-Awlaqi were travelling from Abyan province to Shabwa province, when they came under fire, the source said.
The source said none of the top brass was hurt in the attack that came as they were returning from a trip to monitor an ongoing army offencive against jihadists in Yemen's restive south.
Clashes erupted after the ambush and lasted 15 minutes, the source said.
The attack came hours after a nighttime operation in the capital, in which security forces killed an Al-Qaeda commander suspected of masterminding a wave of kidnap bids targeting Western diplomats.
More From This Section
Hours later, a bombing in Sanaa's diplomatic neighbourhood wounded 11 police officers.
The defence minister, in a statement published earlier today, vowed to crush Al-Qaeda fighters in Yemen.
The ground offencive began on April 29 in Shabwa, Abyan and Baida provinces, where a wave of US drone strikes killed scores of suspected Al-Qaeda militants last month.
Yesterday, the army said it entered the town of Azzan, the second largest in Shabwa and a major stronghold of Al-Qaeda in the Arabian Peninsula (AQAP), which is seen by the United States as the network's deadliest franchise.