BEIRUT — Rebels fighting in Syria’s civil war crossed into Lebanon and raided a border town Saturday, killing and capturing security force members in the most serious incursion into the tiny country during its neighbor’s 3-year-old conflict.

The rebels, who included foreign fighters, demanded to trade soldiers and police officers it captured in Arsal for some of the “most dangerous detainees,” the Lebanese army said in a statement.

Masked gunmen roamed the streets as Lebanese helicopter gunships flew over the town, about 55 miles from the capital, Beirut.

A Lebanese army general said the gunmen attacked army positions near Arsal and troops returned fire. Another official said the gunmen also took control of the main police station in the town.

Lebanon’s state-run National News Agency reported that Arsal residents later freed police officers at the station, though rebels captured some weapons and released several detainees. It said gunmen killed two residents near the police station.

A picture posted online allegedly showed gunmen in Arsal driving away with about a dozen men, two of them in police uniforms.

The photograph corresponded to other AP reporting about the attack.

Gunmen killed two soldiers and wounded several others, the National News Agency reported.