The attack Friday took place amid fierce fighting in the capital Sanaa and a widening conflict elsewhere in the impoverished country, where an uprising against Saleh is challenging his nearly 33 years in power.
Global powers are worried that Yemen, home to a wing of the militant group al Qaeda known as AQAP and bordering the world's biggest oil exporter Saudi Arabia, could become a failed state and make Gulf oil shipments more vulnerable to attack.
|Anti-government protesters shout slogans during a rally to demand the ouster of Yemen's President Ali Abdullah Saleh in Sanaa June 2, 2011|
Speaking only via audio in a televised speech Friday night, Saleh blamed the attack on the powerful Hashed tribe led by Sadeq al-Ahmar who has been battling Saleh loyalists in Sanaa. Ahmar later denied responsibility.
"I salute our armed forces and the security forces for standing up firmly to confront this challenge by an outlaw gang that has nothing to do with the so-called youth revolution," Saleh said. "Seven officers were martyred."
The deputy information minister said earlier that Saleh, 69, had suffered minor injuries but was in good health.
A senior diplomat said the prime minister, his deputy, the parliament speaker and other aides were hurt in the attack.
Yemen has tipped swiftly toward civil war this week, with Hashed tribesmen battling Saleh forces in Sanaa.
More than 370 people have been killed since a popular uprising against Saleh began in January, at least 155 of them in the last 10 days.
Friday, fierce fighting engulfed the capital, where residents cowered in their homes as explosions rocked the city.
"A cowardly attack with an explosive projectile took place during Friday prayers at the presidential palace mosque where ... Saleh and senior government officials were present," state news agency Saba said.
Forces loyal to Saleh later shelled the homes of the leaders of the Hashed tribal federation, security sources said.
The United States and the European Union condemned the rising violence and urged Saleh to accept a peaceful transfer of power.
Saleh has exasperated his former U.S. and Saudi allies who had once seen him as a key partner in efforts to combat al Qaeda in the Arabian Peninsula (AQAP).
Defying world pressure, Saleh has thrice reneged on a deal brokered by Gulf states for him to quit in return for immunity from prosecution, even as he loses support at home.
Yemen's increasingly bloody struggle looks sure to go on as long as Saleh refuses to step down and it will complicate the already formidable challenge of uniting the country and rebuilding shattered state institutions in any post-Saleh era.
One constant factor is poverty. Jobs and food are scarce, corruption is rampant and two-fifths of the 23 million people struggle to live on less than $2 a day.