Hundreds of barefoot worshipers fled in panic as powerful explosions struck two packed mosques in the northern Lebanese city of Tripoli on Friday, killing at least 27 people and marking a sharp deterioration of the security situation in the fragile Middle Eastern country.

The coordinated car bombs detonated outside two Sunni mosques in the port city during Friday prayers, their busiest time. In an illustration of the multiple threats imperiling the country’s stability, the attacks occurred just hours after Israeli warplanes bombed a militant base in the south.

The explosions heightened concerns that Lebanon is entering an era of retaliatory Sunni vs. Shiite attacks that target civilians. Just eight days earlier, a car bomb killed at least 21 people in a Shiite suburb of Beirut, a support base for the Lebanese militant movement Hezbollah, in the country’s deadliest blast since the 1980s.

Lebanese television stations showed huge plumes of smoke rising from the explosion sites Friday, as the dead and injured were carried from the rubble-strewn streets, over the twisted wreckage of vehicles.

The scenes were reminiscent of the bombings that have plagued Iraq for years — an ominous parallel for Lebanon, which has a history of targeted political assassinations and sectarian clashes but where religiously motivated bomb attacks aimed at civilians have been rare. The escalation comes as the war in neighboring Syria is intensifying friction between Sunnis and Shiites across the region and as Lebanon struggles to remain stable despite a vacuum in government and an army that is outgunned by Hezbollah.

The Shiite group ramped up tensions further when it announced in May its unstinting support for Syrian President Bashar al-Assad in his fight against a largely Sunni opposition.

In the aftermath of the blasts, residents marched in protest through the streets of Tripoli and gunmen attacked an army checkpoint there, according to a Lebanese army commander who spoke on the condition of anonymity because he is not authorized to speak to reporters.

“Their first angry reaction was against the Lebanese army,” he said. Some Sunni factions have accused the army of being under Hezbollah’s influence.

Tripoli, 50 miles north of Beirut, has a reputation as Lebanon’s most volatile city and the one where the country’s sectarian fault lines are most pronounced. Sunni gunmen there regularly battle the city’s small community of Alawites, who are an offshoot of the Shiite sect and co-religionists of Assad.

“There is no state. This is the state of Hasan Nasrallah,” a bloodied victim told LBCI television from his hospital bed, referring to Hezbollah’s leader.

No one had claimed responsibility for the Tripoli bombings by Friday afternoon, but many observers pointed out that preachers at both mosques are outspoken opponents of the Syrian government and had urged Lebanese to go to Syria to fight against Hezbollah and Assad’s forces.

A 29-year-old Tripoli resident who gave her name as Umm Malek said she was on the phone walking to her car when the first blast hit the al-Taqwa mosque, known for its hard-line Islamist preacher, with such force that it left her gasping for air. When people started running and screaming, she said, she followed the crowd.

Recent instability in Lebanon

“I fought them to be able to head to my car, then I started seeing a number of people carried on motorbikes with blood gushing from their heads and from their hands,” she said.

She said she was in her car when she heard the second explosion, which the Interior Ministry said was caused by a 220-pound car bomb planted outside the al-Salam mosque.

The moment that blast occurred was captured on security camera footage, which showed doors and windows of the mosque being blown in and worshipers, including children, scrambling frantically to get out of the building.

Lebanon’s state-run National News Agency said a total of 27 people were killed and as many as 352 injured, citing the Health Ministry. The Lebanese Red Crescent said 29 died, while Reuters news agency put the count at 42. Hospitals pleaded for blood donations.

Emile Hokayem, a Middle East analyst with the International Institute for Strategic Studies, said it was unlikely that Hezbollah was behind the bombings.

“Mainstream factions in Lebanon didn’t want a full-blown escalation, and I still don’t think they want this,” he said. “The game was contained for 21 / 2 years because of this, but the erosion of the state, erosion of security and Hezbollah’s overt involvement in Syria have changed the equation.”

Hokayem pointed to a smaller group or an agent acting on behalf of the Syrian government as a potential culprit, citing the arrest last year of Michel Samaha, a former Lebanese information minister, for allegedly plotting a string of bombings in Lebanon at the behest of Damascus.

In a statement, caretaker Prime Minister Najib Mikati, a Sunni, blamed the “hand of criminality” for the bombings, which he described as “a clear message aimed to plant strife.”

U.N. Secretary General Ban Ki-moon strongly condemned the attacks in a statement in which he also urged “all Lebanese to exercise restraint, to remain united, and to support their State institutions, particularly the security forces.”

The State Department issued a statement condemning what it called the “terrorist bombings” and called on all parties to “desist from actions that could contribute to an escalating cycle of retribution and violence.”

Earlier Friday, Israel said it had bombed a militant group’s base in Lebanon in response to the firing of four rockets across its northern border Thursday. It was Israel’s first airstrike inside Lebanon since its 2006 war with Hezbollah.

The target was a base belonging to the Popular Front for the Liberation of Palestine — General Command near the town of Naameh, 10 miles south of Beirut, the state-run news agency reported.

Speaking to Lebanon’s state-run al-Manar television station, Abu Imad Ramez Mustafa, a Popular Front official, said he was surprised his group had been targeted when an al-Qaeda-linked organization, the Abdullah Azzam Brigades, had claimed responsibility for the attack a day earlier.

Tensions have also been rising between Lebanon and Israel recently, also due in part to the entrenched Syria conflict. Hezbollah claimed responsibility last week for planting explosives that injured four Israeli soldiers near the border in early August.

An Israeli military spokesman said the pilots who carried out the retaliatory airstrike “reported direct hits on the target” and added, “Israel will not tolerate terrorist aggression originating from Lebanese territory.”

Later Friday, Minister for Public Security Yitzhak Aharonovitch said in a televised interview after touring the north that Israel is “sending a clear message that anyone who tries to hurt Israel will pay the price.”

A written statement released Friday morning by the Israeli army said it holds the Lebanese government responsible for the rocket attack.

Suzan Haidamous in Beirut and William Booth and Ruth Eglash in Jerusalem contributed to this report.