The army says a female Tamil Tiger suicide bomber - pretending to be pregnant - detonated a bomb close to a car carrying Lt Gen Sarath Fonseka, the head of the army.
Hospital officials say that Lt Gen Fonseka had serious chest and abdomen injuries and remains in a serious condition. He has a reputation for taking a tough line against the rebels.
Eight of the commander's bodyguards who escorted the car on motorcycles were killed on the spot, the police say, and several other people were injured.
This is the first such attack in the Sri Lankan capital since July, 2004 and security forces all over the country are now on a maximum state of alert.
Relatives of Lt Gen Fonseka in the compound after the attack.
The Sri Lankan president, Mahinda Rajapakse, prepared to go on television to give his reaction to the bombings.
The president told Sri Lankans his government did not want war, but warned the rebels it would not be cowed by such attacks.
Security forces have had to deal with Tamil Tiger suicide attacks since the late 1980s.
The Tigers last week pulled out of planned peace talks in Europe. Tuesday's attack puts the peace process under greater pressure, analysts say.