Powerful car bombs exploded Friday outside two Sunni mosques in a Lebanese city riven by strife over the war in neighbouring Syria, killing 42 people and wounding hundreds, an official said.

That was the highest toll in an attack since Lebanon's 1975-1990 civil war, and brought condemnation from Western powers, the United Nations and Syria.

Coming a week after a bombing in the Beirut bastion of Shiite party Hezbollah, a close ally of Bashar al-Assad, the bombings in the northern port of Tripoli risk further stoking tensions between supporters and foes of the Syrian president.

"The death toll has risen to 42," a security source told AFP, a few hours after the early-afternoon attacks.

Earlier, the Lebanese Red Cross earlier said there were also at least 500 wounded, with director Georges Kettaneh adding that many of them had serious burns and head wounds.

The blasts hit during weekly Muslim prayers, in a city where Sunni supporters of Syria's rebels engage in frequent, often deadly, clashes with Alawites, who back the Assad regime.

The first bomb struck in the city centre at the Al-Salam mosque as worshippers were still inside.

Local television showed images from a CCTV camera of people sitting on the floor listening to a talk, when the explosion hit and they scattered in panic.

The second explosion struck just minutes later outside Al-Taqwa mosque, about two kilometres (a little more than a mile) away, near the port.

An AFP reporter saw a number of charred bodies near Al-Taqwa and the bodies of five children brought out of it.

As huge clouds of black smoke billowed into the air, television channels aired footage of the dead, of buildings with their fronts blown in and vehicles ablaze.

Hundreds of furious people gathered outside the Al-Taqwa mosque shouting curses at Hezbollah and the Syrian regime.

The powerful Shiite movement, whose militia have been fighting for months alongside Assad's troops, linked the Tripoli attacks to the one in Beirut on August 15, which killed 22 people and injured more than 300.

It said they were part of a plan to "plunge Lebanon into chaos and destruction".

Former premier Saad Hariri, a Sunni and Hezbollah opponent, said the "authors of dissension do not want Lebanon to live in peace for one minute; they want the killing machine to mow down the lives of innocents across Lebanon".

Hariri's father and former billionaire prime minister, Rafiq Hariri, was assassinated in a 2005 car bombing in Beirut that also killed another 22 people which was, until Friday, the worst attack since the civil war.

Syrian Information Minister Omran al-Zohbi condemned this "cowardly terrorist attack on our brothers in Tripoli."

In London, Foreign Office Minister Alistair Burt condemned what he called the "abhorrent attacks" while French President Francois Hollande spoke of what he called "odious, cowardly attacks."

For his part, UN Secretary General Ban Ki-moon called on Lebanese to "exercise restraint, to remain united," while expressing hope that "those responsible for such cowardly acts of violence will be brought to justice as soon as possible."

Washington also condemned the attacks and, in Beirut, its embassy warned Americans to "exercise security restraint" in Lebanon and reminded others to avoid travelling there.

On Wednesday, army chief General Jean Kahwaji had said his forces were fighting a "total war" against terrorism whose aim is "to provoke sectarian strife" in the country.

The army had been pursuing a "terrorist cell that prepares car bombs and sends them to residential neighbourhoods," he said, adding that this action aimed at provoking sectarian strife.

A Lebanese and two Palestinians suspected of preparing a car bomb attack were arrested days after the latest blast in Beirut, the General Security agency said.

Tripoli has seen frequent Syria-related violence over the past two years, including waves of deadly clashes.

Lebanon is officially neutral in Syria's conflict, but the country is deeply divided.

Hilal Khashan, chairman of the political science department at the American University of Beirut, said: "It is clear that there is a desire to trigger a confessional war in Lebanon to divert attention from what is happening in Syria."

Friday's car bombings were reminiscent of attacks that shook the country during the civil war, but Khashan said he did not think a confessional war would break out "because it will not benefit anyone."