Why are US troops in the Syrian city of Manbij? The city is where U.S. troops were killed Wednesday while on foot patrol.

The location of Wednesday's bomb blast that killed American service members -- the northern Syrian city of Manbij -- has proven vitally strategic for U.S. forces who have had a highly visible presence there for nearly two years.

The Americans have conducted patrols in the city, in vehicles, and on foot, to act as a buffer between Turkey and the U.S.-led coalition's Kurdish partners, a group that's been critical to the fight against ISIS but which Ankara classifies as terrorists.

Manbij has long had a historic population mix of Arabs, Kurds, and other minority groups and was part of a swath of territory overtaken by ISIS. During the summer of 2016, the U.S.-backed Syrian Democratic Forces (SDF), of which the Kurds make up a significant portion, retook the city to the dismay of Turkey, which didn't like the Kurds operating so far west into Syria and close to their border.

In response, Turkey began threatening those partners in Manbij, and the U.S. had to work to prevent the Turks from carrying out any attacks. At the same time, Syrian regime forces and their Russian backers recognized the town's strategic value as well and -- not wanting Turkey to have control of the area -- Russia sent troops to begin patrolling near Manbij.

By March 2017, the U.S. decided to send hundreds of American troops to Manbij to be a visible presence in the city, so as to prevent Turkish forces from attacking the Kurds and also keep Russian forces at bay.

The troops flew the American flag on their vehicles -- a practice not common in other parts of Syria -- because, as a Pentagon spokesman said at the time, they would be "a visible sign of deterrence and reassurance." The U.S. also worked to slowly remove the Kurds from the Manbij Military Council, a group put in place by the SDF, in order to ease Turkey's concerns.

Over time, the U.S. vehicle patrols have included "dismounted" patrols with American forces in the city on foot, which is what the U.S. service members who were killed on Wednesday were doing at the time of the explosion.

As Turkey continued to issue threats against the Kurds, the U.S. also sought to ease tensions by carrying out joint U.S.-Turkey patrols to the north of Manbij. After months of delays, the joint patrols began last fall, but they were the closest that Turkish troops could come to the city.

Since the Trump administration's decision to withdraw U.S. troops from Syria, Syrian and Russian forces have once again gotten closer to the city, but have not entered. Kurdish elements welcomed the Syrian advance, fearing that Turkey would invade the city once U.S. troops pulled out.

Those fears may very well be founded. Reuters reported on Wednesday that the head of a Turkish-backed militia group was waiting to launch an assault on Manbij if given the go-ahead by Ankara, which is in dialogue with Washington to see how the U.S. withdrawal unfolds.

ABC News' Elizabeth McLaughlin contributed to this report.