Turkey's armed forces shoot down a Syrian plane after it crosses into Turkish airspace. (Reuters)

Turkey’s military shot down a Syrian jet Sunday after it allegedly strayed into Turkish airspace during fierce fighting between Syrian rebels and government forces in which a relative of President Bashar al-Assad was killed.

The shooting threatened to escalate tensions between Turkey and Syria just as Turks go to the polls to vote in municipal elections in the first test of Prime Minister Recep Tayyip Erdogan’s popularity since anti-government protests in Istanbul last year.

Erdogan announced the jet’s downing at a campaign rally Sunday afternoon, telling a huge crowd of supporters that Turkish F-16s had brought down the Syrian plane.

“Why?” he asked the crowd. “Because if you violate our airspace, from now on our slap will be hard.”

Syria condemned the shooting as “unprecedented and unjustifiable,” according to comments from an unnamed Foreign Ministry official quoted by the official Syrian Arab News Agency.

State television said the pilot ejected safely from the aircraft, which crashed on the Syrian side of the border, according to footage broadcast on Turkish television networks.

There was no indication that Syria planned to retaliate for the attack, which marked the first time Turkey has shot down a plane since Erdogan threw his government’s support behind Syria’s rebels nearly three years ago.

It is not, however, the first time that tensions have flared between the two countries. Syria shot down a Turkish warplane in 2012, and Turkey downed a Syrian helicopter in September. Turkey has also fired mortars into Syria on several occasions, hitting rebel and government positions. NATO has deployed four batteries of Patriot missiles near the border, at Turkey’s request, to defend against a possible Syrian missile attack.

Syria focused its criticism on Erdogan, saying the incident reflected his “failure to handle the needs of the Turkish people,” and it reiterated long-standing complaints about the logistical support he has offered to the rebels battling to topple Assad.

Erdogan is closely associated with Turkey’s support for the rebels fighting Assad, with whom he once enjoyed a close relationship. But he has toned down his anti-Assad rhetoric over the past year amid signs that the rebels are unlikely to topple him and that Turks are skeptical about a policy that has brought a flood of hundreds of thousands of Syrians into their country and empowered Islamist extremists along Turkey’s borders.

Syria has made little secret of its hopes that Turks will oust Erdogan in a series of votes scheduled this year, starting with next weekend’s municipal elections. The Syrian statement referred to the corruption allegations against him and to last year’s widespread anti-government demonstrations.

Yet, most polls show that Erdogan’s Justice and Development Party, or AKP, will retain the support of a plurality of voters, despite unease with his growing authoritarianism, illustrated by an attempt Friday to ban Twitter.

The Syrian jet had apparently been supporting troops battling rebels who have been trying to win control of one of the last Syrian government-controlled border crossings into Turkey, at Kasab in the province of Latakia.

Video posted on Facebook showed rebel fighters from the al-Qaeda-affiliated group Jabhat al-Nusra and another Islamist group, Ansar al-Sham, in control of the Kasab crossing Sunday. Rebels had seized the nearby town, where another video showed that they had toppled a statue of late president Hafez al-Assad, the current president’s father.

Among those killed was Hilal al-Assad, a cousin of the president, the Britain-based Syrian Observatory for Human Rights said.

State television confirmed the death and described Assad as the head of the National Defense Force militia in the coastal province of Latakia, where the Assad family originates, the Reuters news agency reported.

Meanwhile, in Beirut, one person was killed and 13 were injured Sunday when clashes erupted between Sunnis who support Assad and Sunnis who oppose him. The Lebanese Army deployed in the area and separated the factions.