By Stephen Kalin and Phil Stewart

BAGHDAD (Reuters) - When Prime Minister Haider al-Abadi pledged in December that Iraq would retake Islamic State's de facto capital Mosul by the end of 2016, the target was greeted with scepticism by Western allies and officials within his own government.

Less than seven months on, the Iraqi military has recaptured most major militant positions in western Anbar province and advanced toward Mosul, the largest city still under the ultra-hardline group's control across its self-proclaimed caliphate.

Last month's recapture of Falluja, followed swiftly by Qayara airbase 60 km (40 miles) south of Mosul and the announcement of a fresh deployment of U.S. forces, lent momentum to the campaign, which the administration of President Barack Obama would like to finish before January.

"Progress against Daesh (IS) has now put liberation of Mosul strongly on the agenda," the top United Nations official in Iraq said last week.

Abadi, backed by a U.S.-led military coalition, now wants to move on Mosul by October, a senior Baghdad-based diplomat and a Western official said, both declining to be identified.

Asked about the October date, Abadi's spokesman reiterated the year-end timeframe but said the timing of specific actions were up to military commanders and would not be made public.

Despite growing confidence in Iraq's military two years after it collapsed in the face of Islamic State's advance, much remains to be done to prepare for Mosul and critics say Abadi's year-end deadline is still too ambitious.

Mosul and Tel Afar, another IS stronghold 65 km to the west, have been ringed by Kurdish peshmerga forces from the east, north and west for months, but jihadists are operating in a vast desert area to the south spanning 14,000 square km (5,400 square miles) between the Tigris river and the Syrian border.

War planners say the campaign needs 20,000-30,000 troops. Forces must advance from Qayara, where 5,000 army forces and a division from the counter-terrorism service (CTS) are stationed. Other army and CTS units will also be mobilized.

A few thousand police and 15,000 local fighters are being organized to hold land after the assault.

"IMPORTANT MILESTONE"

"While Qayara is an important milestone for the Iraqis, they still have a long way to go to reach the outskirts of Mosul, and then the bigger challenge is to cordon off south of Mosul," said a source in the Kurdistan regional security council. "Qayara is just one point in that wide corridor."

U.S. forces, which peaked at around 170,000 military personnel after the 2003 invasion that toppled Saddam Hussein, failed to secure the area southwest of Mosul completely when they fought al Qaeda, Islamic State's predecessor.

And Western officials say retaking Mosul without a plan to restore security, basic services and governance, along with money and personnel to implement it immediately, risks repeating the mistake the Bush administration made in 2003, by toppling the government without plans for a new one.

U.S. and Iraqi authorities are confident troops will be ready for the assault on Mosul.

Given its recent success, they will likely use a "starburst" attack, a U.S. military official said, thrusting to the center with air strikes and then attacking IS defenses from behind.

"You don't necessarily have to fight the whole city at once. You maybe only have to fight pieces and parts of the city."

Spokesman Sabah al-Numan said CTS would strike from multiple directions with intense air support he described as "shock and awe". He declined to comment on when any assault might take place.

FLIGHT OR FIGHT

Yet much depends on how IS responds. Mosul still houses one million civilians and has strong symbolism as the place where the caliphate was declared in June 2014.

The Kurdish security source, echoing Iraqi officials, expects the jihadists "to fight to die, till the last bullet".

The source said up to 10,000 jihadists are in the city, though a coalition spokesman said that was high and likely to fall ahead of the assault.

An alternative scenario envisions an outflow of fighters resigned to lose Mosul but live to fight another day, which IS media may already be preparing its supporters for.

The caliphate cannot "be eliminated by destroying some city or besieging another", al-Nabaa newspaper said last month.

Coalition head Lieutenant General Sean MacFarland expects senior leaders and foreign fighters could flee "just as they tried to do in Falluja – unsuccessfully".

Jihadists may use desert paths to enter Syria, where an array of forces affords them better cover, said Bill Roggio, a counter-terrorism expert at the Foundation for Defense of Democracies.

"They've seen this movie before, in 2007 to 2009," he said, referring to the U.S. troop surge which incapacitated al Qaeda. "They know when they fight to the death it's going to not end up well for them."

The presence of IS "war minister" Abu Omar al-Shishani, reportedly killed near Qayara last week, suggests IS may dig in at least initially. "That's an indicator that was where they were really focused," MacFarland said of an air strike targeting Shishani.

RISK OF CONFRONTATION

If IS fails to mount significant resistance, analysts say the force Baghdad has prepared will be enough to achieve victory.

Otherwise, it may need peshmerga and Iranian-backed Shi'ite militias to move in from other positions, risking confrontation with Mosul's diverse ethnic and sectarian communities wary of those factions, which have been accused of abuses.

The Kurdish security source said the peshmerga, literally "those who confront death", could take more villages near Mosul but without entering the city. The Kurds have pushed back IS in northern Iraq, thus expanding their region's territory.

Prime Minister Abadi, who risks broad criticism if pro-government units overstep in Mosul, will try to contain the Shi'ite militias as he did with mixed success in Falluja, but he may be unable to withstand political pressure from rivals and their Iranian supporters, the senior diplomat said.

Baghdad could also seek more coalition ground support. General Joseph Votel, who oversees U.S. forces in the Middle East, has said the Pentagon would likely request even more troops for Iraq, without specifying when or what type.

U.S. soldiers have provided close artillery support to Iraqis and conducted raids against IS, both of which could expedite the Mosul offensive. Engineering units could also be key if IS blows up bridges over the river running through Mosul.

"Every time we take a city back from the enemy, we learn a little bit," said MacFarland. "The enemy also gets a little bit weaker, so we find that we're able to use different types of tactics."

(Additional reporting by Ahmed Rasheed and Jonathan Landay; Writing by Stephen Kalin, editing by Peter Millership)