Attackers opened fire on a prison bus outside Colombo on Monday, killing five prisoners and two armed guards in the worst gang-related violence to hit Sri Lanka in decades.
Police said the gunmen sprayed bullets at the bus as it passed through a wooded area near the capital, also wounding four guards.
One of the victims was a senior member of an underworld group operating in Sri Lanka, where automatic weapons remain easily available eight years after the end of a decades-long war.
"It is believed that the shooting was a result of enmity between two underworld gangs," police said in a statement.
"Investigations are under way."
The prisoners were being driven to court for a hearing when the audacious daytime attack took place, police said.
Police said Monday's bus ambush was the deadliest gang-related attack in Sri Lanka in living memory.
President Maithripala Sirisena deployed troops last year to bolster police efforts to crack down on gang-related activity, which experts say has been rising.
Most gangs make their money from protection rackets, often in league with politicians, or from illegal drugs and liquor.
Security for underworld suspects had also been tightened following a shooting on a prison bus that seriously wounded another suspected gang leader in the capital in March last year.
Police set up roadblocks in and around the capital after six people were killed in two separate incidents on that day.
But the barriers brought back unwelcome memories of wartime Colombo when residents had to undergo frequent stops for security checks, and police had been removing them in recent months.
Several police have also been killed by gangsters in the past year despite stepped-up police operations across the country.
"Underworld activities slowed down a bit last year, but they seemed to be getting more active in recent months," a senior officer in Colombo told AFP.
Large quantities of weapons found their way to criminal gangs during and after the war ended in May 2009 and attempts to tackle the problem have been largely ineffective.
At least 100,000 people were killed in the 37-year conflict, which ended after a major offensive by the military.