Military spokesman Brigadier Udaya Nanayakkara said security forces were not involved in the attack, which the International Committee of the Red Cross said caused the deaths of 16 patients at Putumattalan on Monday.
Nanayakkara said the military had allowed the ICRC to evacuate 240 patients and 116 others from the hospital to a safer area after the shelling.
"We did not fire at this location on Monday and it is quite possible that the LTTE (Liberation Tigers of Tamil Eelam) attacked them," Nanayakkara said, adding the guerrillas were stopping civilians from fleeing rebel-held areas.
The ICRC did not say who was responsible for Monday's attack, but urged both the government and the Tigers to spare civilians.
"We are shocked that patients are not afforded the protection they are entitled to," said Paul Castella, head of the ICRC delegation in Colombo.
"Once more, we call on both parties to meet their obligation under international humanitarian law to spare at all times the