BEIRUT (AP) — The U.S.-led coalition and local officials said Saturday that Syrian Islamic State fighters and civilians will be allowed to evacuate Raqqa, a deal that signals the imminent capture of the city but flouts earlier U.S. protests of negotiating safe exits for the extremist group.

Foreign fighters will be excluded from the evacuation deal, the coalition said.

The U.S.-backed Kurdish-led Syrian Democratic Forces said the final battle for Raqqa was underway, apparently propelled by negotiation efforts that secured the surrender and evacuation of dozens of Syrian militants still holed up in the city.

In a statement, the U.S.-led coalition said a convoy of vehicles was set to leave Raqqa following the deal brokered by a local council formed by their Kurdish allies and Arab tribal leaders.

The tribal leaders said they appealed to the coalition and the SDF to allow the evacuation of local Islamic State fighters to stem further violence.

"Because our aim is liberation not killing, we appealed to the SDF to arrange for the local fighters and secure their exit to outside of the city, with our guarantees," the tribal leaders said in a statement.

It was not clear how many evacuees there were or where they would go, but the tribesmen said their evacuation would save the lives of civilians who the extremist fighters have used as human shields. Last week, there was an estimated 4,000 civilians still in the city.

With the push to liberate the Arab-majority Raqqa led by Kurdish-dominated forces, local officials fear a backlash once the city falls. The initiative appeared to be an attempt by local leaders to stem such tension.

The Syrian Observatory for Human Rights said the talks were bogged down over the fate of the foreign fighters there, which according to a local Kurdish commander include French, Russian, Azeri, Indonesian and Turkish combatants.

The U.S.-led coalition said it "was not involved in the discussions that led to the arrangement, but believes it will save innocent lives and allow Syrian Democratic Forces and the Coalition to focus on defeating Daesh terrorists in Raqqah with less risk of civilian casualties." Daesh is an Arabic acronym for IS.

The evacuation deal places the U.S. in a bind as it had earlier said that only surrender, not a negotiated withdrawal for IS fighters in Raqqa, would be accepted. The top U.S. envoy for the anti-IS coalition, Brett McGurk, had previously stated that foreign fighters in Raqqa would die in the city. Omar Alloush, a senior member of the Raqqa Civil Council, said Friday around 100 militants had surrendered.

U.S. Defense Secretary Jim Mattis told reporters travelling with him Friday that the U.S. would accept the surrender of IS militants who would be interrogated for intelligence purposes.

"Right now, as the bottom drops out from underneath (IS), more and more of them are either surrendering — some are trying to surrender, and some amongst them — more fanatical ones aren't allowing them to," he said, using a different acronym for the extremist group.

Only weeks ago, the U.S. coalition obstructed a Hezbollah-negotiated deal to evacuate IS fighters from its borders with Syria toward the border with Iraq. The coalition bombed the road used by the convoy evacuating the militants, only to finally capitulate following Russian calls asking it to allow Syrian troops in the area to advance.

It is also not clear what kind of justice would be meted out to those surrendering militants in the absence of established courts in Kurdish-dominated northern Syria.

A senior local Kurdish commander said foreign fighters were unlikely to surrender so his forces are expecting to "comb them out" of at least two neighborhoods. He said it could be a matter of a day or two.

Scores of civilians were seen in a video Friday leaving Raqqa in desperate and terrified conditions. They emerged from destroyed districts, some of them collapsing on the ground in exhaustion as they arrived at a Kurdish-held area of the city, in haunting scenes reflecting their years-long ordeals.

The U.S.-led coalition said it expects "difficult fighting" in the days ahead to completely oust IS from the city and secure it. SDF and U.S. officials said the remaining militants are mostly suicide bombers who only have small arms and rifles. Backed into a small area, they have no access to their weapon of choice, car bombs, said Mustafa Bali, an SDF spokesman.

Also Saturday, the Syrian and Russian militaries announced that Syrian troops and allied fighters had seized the town of Mayadeen, an Islamic State stronghold in the country's east. The Russian Defense Ministry's spokesman, Maj. Gen. Igor Konashenkov, said Syrian soldiers had driven IS fighters from the town, which he said was the extremist group's last major stronghold in eastern Syria.

Over the past months, Mayadeen had become a refuge for IS's leaders as they faced an intense crackdown in Syria and Iraq.

On the western bank of the Euphrates River, Mayadeen was also a major node in the race for control of the oil-rich eastern Deir el-Zour province that straddles the border with Iraq. Washington has feared advances by Syrian troops and allied fighters could help Iran expand its influence across the region and establish a "Shiite corridor" of land links from Iraq to Lebanon, and all the way to Israel. Iran backs militias fighting alongside the Syrian military.

Diverting fighters from the battle for Raqqa, the U.S.-backed SDF made a bid for the province to secure territories there, focusing on securing the Iraq border, still mostly controlled by IS.

The Syrian government eyed Mayadeen earlier this month, fearing the SDF would get there first. The race accelerated amid fear of potential confrontations as Syrian troops crossed the Euphrates river to reach the oil-rich eastern banks.

Rami Abdurrahman, head of the Observatory, confirmed that government troops, backed by Shiite militias, had taken control of Mayadeen but said they were still combing it for militants.

With the fall of Mayadeen and retaking of Raqqa, Islamic State fighters are losing two of their last strongholds in Syria as their self-declared caliphate crumbles. The militants are currently besieged in the city of Deir el-Zour, leaving them with one last major urban bastion, the strategic town of Boukamal, on the border with Syria and Iraq.

Militants seized Raqqa in 2014, the first city to fall under the full control of the extremist group, and declared it the caliphate of their self-styled caliphate. It became synonymous with IS's reign of terror, with public killings and beheadings — videotaped slayings that have shocked the world. It was also from Raqqa, which became a destination for foreign fighters from around the world, that many of IS's attacks in the West were plotted.

The latest battle for Raqqa began in June, with heavy street-by-street fighting amid intense U.S.-led coalition airstrikes and shelling. The battle has dragged on in the face of stiff resistance from the militants.