Attackers opened fire at a vehicle carrying General Katumba Wamala, Uganda’s former army commander, killing his daughter and driver.
The attack happened on Tuesday morning in Kisaasi, a suburb of the capital, Kampala.
Wamala sustained injuries in both his shoulders, doctors said.
“I have survived. God has given me a second chance,” Wamala said from his hospital bed in a video tweeted by government-owned broadcaster, UBC.
Wamala served as the commander of Uganda’s land forces from 2005 to 2013, overseeing the country’s deployment of troops to Somalia in 2007.
He was elevated to Chief of Defence Forces (CDF) in 2013 and is currently the east African country’s minister for transport.
Images circulating on social media showed Wamala with his mouth open, in apparent distress beside the car and his shirt bloodied.
Social media images also showed bullet holes in a car window and spent cartridges on the ground.
"We leave it to the investigators to find out the people who did it and what was their motive, and hopefully they will give us a report to establish what was behind this," Ugandan State Minister for Housing Dr. Chris Baryomunsi, stated.
In a statement, the army said Katumba was attacked by two gunmen riding on motorcycles.
There have been several unresolved murders targeting senior security officials, a legislator, a prosecutor and Muslim clerics in recent years in Uganda.
The gun attacks prompted President Yoweri Museveni to order the installation of surveillance cameras in the capital and in major towns across the country.
Critics however say the cameras are used by security officials to track the opposition and dissenters.
In a statement on Twitter, Museveni called Wamala's attackers 'pigs'.