He said: "The government should take the responsibility for this tragic death. Maheswaran's security was reduced during the last two weeks, making him vulnerable for an attack of this nature.
"He spoke about corruption, malpractices, abductions, unlawful killings and blamed government for not taking effective measures to stop them."
The military said unidentified gunmen shot the parliamentarian while he was in a Hindu temple and police are investigating.
"Inside the [temple] unidentified gunmen had shot Mr Maheshweran and it was reported he died after being admitted to the hospital," Brigadier Udaya Nanayakkara, a military spokesman, said.
The military said another civilian died after being admitted to the hospital and seven others were injured from the firing.
|"He spoke about corruption, malpractices, abductions, unlawful killings and blamed government for not taking effective measures to stop them"|
Tissa Attanayake, the UNP general secretary
No one has been arrested in the attack, and police declined to give other details.
Maheshweran belonged to Sri Lanka's minority Tamil community, for whom the separatist Tamil Tigers claim to be waging a war against government forces since 1983.
A former Hindu Affairs minister and party chief district organiser of the army-held northern Jaffna peninsula, Maheshweran had survived a similar shooting three years ago while running for general elections.
In 2005 Joseph Pararajasingham, a Tamil National Alliance member of parliament, was shot and killed at a church in the eastern district of Batticaloa while attending Christmas Eve prayers.
Nadarajha Raviraj, another legislator from the same party, was shot and killed in Colombo a year after.
Tuesday's killing came as fighting between government forces and Tamil Tiger fighters was escalating with near daily land, sea and air clashes.
More than 5,000 people have been killed in fighting between the military and Tigers since early 2006 alone, taking the death toll since the war erupted in 1983 to around 70,000.
Military analysts say there is no clear winner on the horizon, and fear the war could grind on for years.