Turkish President Recep Tayyip Erdogan and U.S. counterpart Barack Obama agreed Wednesday to "stem the flow of foreign fighters and secure Turkey's border with Syria," the White House said in a statement, according to Reuters.

The two leaders also discussed a plan to deepen their cooperation in the battle against the Islamic State group, which has taken over major portions of Iraq and Syria and is one of the main lures for foreign fighters seeking to fight in these countries.

Turkey shares a 775-mile, poorly policed border with the fractious country of Syria, which is currently riven by an ongoing conflict between the government and various opposition groups.

The Turkey-U.S. agreement comes after Syria saw an influx of thousands of foreign fighters from across the world through its porous border with the NATO member Turkey. The Islamic militant group has also threatened to conquer Turkey and depose Erdogan.

Earlier this week, a suicide bombing in the Turkish town of Suruc near the Syrian border killed at least 32 people, prompting a condemnation of the attack from Obama. "He conveyed condolences on behalf of the American people to the families of the victims, and the two leaders affirmed that the United States and Turkey stand united in the fight against terrorism," the White House said in the statement.

Turkey has refuted allegations of allowing the Sunni militant group to tacitly operate in Syria and turning a blind eye to the movements of foreign fighters, and promised to take a tougher stance after the bombing. "This attack was against Turkey; against Turkey's democracy; against the peace and welfare of our people; against public order," Turkish Prime Minister Ahmet Davutoglu reportedly said.

Turkey has deployed troops along its border, conducted mass arrests and security sweeps in towns near Syria, arresting over 500 suspected militants in the last six months. The country has also reportedly raised the possibility of deploying troops within Syria in order to combat the extremist group as well as Syrian Kurds.