COLOMBO - Sri Lanka’s ruling party won local elections, but with smaller than expected margins in a crucial mid-term test for President Mahinda Rajapakse, official results showed Sunday.The president campaigned for polls held Saturday for southern and western provincial councils, both in the ethnic majority Sinhalese heartland, which account for more than a third of the country’s electorate. Rajapakse’s Freedom Alliance party secured 33 of the 55 seats in the southern province, down from 38 at the 2009 poll, with three opposition parties winning the rest, final results from the election office showed. The president’s party suffered a bigger erosion of support in the western province where it won 56 of the 104 seats up for grabs, down from 68, with the smaller opposition parties making inroads.Elections for the councils, the highest level of local government, are seen as a gauge of popularity for Rajapakse - who has maintained an iron grip on power since 2009 - and his party ahead of parliamentary and presidential polls due in 2016. Rajapakse’s party won comfortably in his home constituency of Hambantota, with 57.42 percent of the vote, but down from 66.95 won in 2009 in that district, one of three that make up the southern province. There was no immediate comment from the ruling party or the main opposition United National Party whose vote remained steady.Two smaller opposition parties - the Marxist JVP or People’s Liberation Front, and the Democratic Party of former army chief Sarath Fonseka - made significant gains. The department of elections is expected to announce more detailed results in the coming days, including outcomes for individual candidates. The ruling party had tried to turn Saturday’s vote into a referendum on a UN Human Rights Council’s resolution last week to set up a war crimes probe into the island, a move that angered the Rajapakse government.The party asked voters to send a strong message to the UN that ordinary Sri Lankans were against an international probe into allegations up to 40,000 civilians were killed in the final months of the island’s war. The UNHRC adopted the US-led resolution Thursday censuring Colombo and calling for the investigation into the final seven years of the island’s Tamil separatist war between 1972 and 2009. The ruling party was routed at a similar provincial council election in the island’s former war zone in September when the country’s main ethnic Tamil minority party, the Tamil National Alliance, swept the vote.