Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A huge deployment of up to 30,000 fighters has been ordered along Iraq’s western border amid fears that Islamic State could enter from Syria in a repeat of its 2014 offensive.

Two Iraqi Army brigades, each with 3,000 to 5,000 troops, have been redeployed to border areas over the past two days in order to prevent extremist fighters crossing over, according to the Iraqi military.

In addition, Shiite Muslim militias known as the Popular Mobilization Forces (PMF), announced that 20,000 fighters have been redeployed to the same border “to provide border security after some Syrian villages fell under the control of ISIS.”

Iraq is desperate to avoid a repeat of the losses it sustained four years ago when the extremist Sunni Muslim group took over the province of Nineveh and declared a caliphate before spreading farther into Iraq.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Many areas of Syria and Iraq were only recently liberated from ISIS control, although Iraq’s western province of Anbar is still home to many of the group’s militants.

Shiite Popular Mobilization Forces fighter in Tal Afar. STRINGER / Reuters

Ongoing clashes in the region have demonstrated the continuing threat from ISIS, months after authorities on both sides of the frontier declared the militants had been effectively defeated.

Last week, militants launched one of this year's fiercest attacks against the U.S.-backed Syrian Democratic Forces, killing as many as 70 of its fighters.

The PMF said Wednesday it had killed two ISIS commanders who were responsible for the attack.

Last month, ISIS stormed the northern Iraqi village of Gharib, killing three villagers and wounding nine after residents refused to collaborate with them and give them supplies such as food and ammunition.

The U.S. has an estimated 2,000 special forces troops on the ground in Syria assisting the SDF.

Hisham al-Hashimi, an ISIS expert who advises the Iraqi government, said the militant group now operates as it did in 2010 and, despite losing its territorial hold, "still has long arms to strike."

A United Nations report in August said ISIS has up to 30,000 members distributed roughly equally between Syria and Iraq, and said its global network increasingly poses a threat.

"Make no mistake about it, as ISIS has collapsed inward, in their own way, they have reinforced a center as they've been forced into what is now less than 2 percent of their original territory," Defense Secretary Jim Mattis said in Paris last month.