Vice President Biden returned to Iraq for the first time in five years Thursday, determined to help calm the country’s increasingly chaotic politics and ensure that the fight against the Islamic State was not thrown off course by Iraqi infighting.

The vice president’s trip, which was kept secret prior to his arrival, coincided with a tumultuous moment for Iraq and its prime minister, who is battling to hold on to his office amid a paralyzing political crisis, a badly weakened economy and a grinding war against the Islamic State. Biden landed in Baghdad on a military cargo plane and was immediately ferried via helicopter to a meeting with Iraqi Prime Minister Haider al-Abadi, where they discussed plans to drive the Islamic State from Mosul, Iraq’s second-largest city.

“It’s real, serious, and it’s committed,” Biden said of the ongoing military operation and Mosul plans, “and so I’m very optimistic.”

[Islamic State suffers battlefield losses]

Iraqi forces have made significant progress militarily against the Islamic State in the past year, taking back 40 percent of the territory lost to the group.

Vice President Biden made an unannounced visit to Iraq on April 28 in a sign of support for the Iraqi government as it builds on wins in its fight against the Islamic State militants amid the distractions of a political crisis (Reuters)

Biden’s remarks elided a growing worry among top White House officials that the political chaos in Iraq could begin to undermine the battlefield momentum against the Islamic State. The vice president’s trip to Iraq was planned within the past two months, before the political crisis exploded in Baghdad, but the timing of his visit could not be more opportune for the United States.

The political crisis began when Abadi, who has the strong support of the Obama administration, made a bold push recently to replace politically connected members of his cabinet with a new slate of technocrats and reformers. Abadi characterized the move as part of a broader plan to stamp out corruption amid the country’s budget crisis caused by plunging oil prices.

But the proposals alienated powerful blocs within the Iraqi parliament, which has descended into chaotic sessions in recent weeks, with lawmakers throwing water bottles and tissue boxes at each other — and at some points even throwing punches. The antics have made it an uphill battle for Abadi to get parliament to vote on his reshuffle and have led thousands of protesters to descend on the gates of Baghdad’s heavily fortified Green Zone to demand reform.

“Now is not the time for government gridlock or bickering,” President Obama said of the protests last week in Saudi Arabia. Asked about Abadi’s hold on power, Obama described the prime minister as a “good partner” and said he was “concerned.”

The concern over Iraq has led to a flurry of recent visits and promises from top administration officials , including the secretaries of state and defense. In separate trips, they offered more American aid, military advisers and firepower.

[Obama outlines plan to expand fight against Islamic State]

Biden is the highest-ranking U.S. official to visit Iraq since his last trip to the country in 2011, and his presence is a sign of the administration’s commitment to Abadi. The vice president also met with Salim al-Jabouri, the Sunni speaker of the parliament and a key U.S. ally, who recently survived an attempt to oust him by lawmakers staging a parliament sit-in. The rebel parliamentarians claimed to have voted him out, though he contended that there had not been enough members in the legislature to hold a legitimate vote.

Biden made a point of standing beside Jabouri for the press to demonstrate his support for the embattled politician. “This is an old friend,” Biden said, gesturing to Jabouri. “We’ve been doing this a long time. The last time, you were in my office.”

A major goal of Biden’s trip was ensuring that the political infighting among Iraqi leaders did not derail Iraq’s military operations against the Islamic State.

Senior Obama administration officials have said that they would like to see the Iraqis drive the Islamic State from its stronghold in Mosul before the end of the year. Obama has described such a possibility in hopeful, but hedging, terms.

“My expectation is that by the end of the year, we will have created the conditions whereby Mosul will eventually fall,” he said in a recent interview with CBS News.

The political chaos in Baghdad has made the already complicated politics of planning for such an offensive into treacherous urban terrain even harder. “Mosul is a multi-ethnic, multi-sectarian place,” said the senior administration official. “What you don’t want is a race to Mosul from a bunch of different forces that end up getting in each other’s way or clashing with each other.”

[Obstacles hamper Iraqi goal to retake Mosul]

The vice president, who was handed the Iraqi portfolio by Obama in 2009, has remained immersed in the country’s political, ethnic and sectarian struggles for much of the past seven years.

“This is my 27th or 28th, I don’t know how many, times,” Biden said before his meeting with Jabouri.

In fact, the vice president has visited the country at least 17 times as a senator and vice president. Biden is also connected to Iraq through his son Beau, who spent a year deployed to the country and who died of brain cancer last year. In a brief meeting with about 200 U.S. Embassy personnel, Biden spoke of his son and his service three times in a 12-minute speech that praised the troops and embassy civilians in the room for their service in the war zone.

At one point, he referred to an unnamed former Iraqi prime minister who was challenging him about the U.S. commitment to Iraq, to which Biden said he responded: “Would you send your son to my state to defend me?”

“And he shut up,” the vice president added.

In the past few days, there have been some signs that the political crisis surrounding Abadi is stabilizing. Recently, Iraq’s parliament approved Abadi’s request to replace six of his 22 cabinet ministers, but the moves came only after opposing lawmakers moved to another room, and the rebel lawmakers claim they were locked out.

The replacement of the more high-powered ministers demanded by thousands of protesters who have gathered outside the Green Zone is still to come. Abadi is expected to present his candidates for those positions on Saturday.

In his speech to the embassy staff, Biden paraphrased the Irish writer James Joyce when describing the plight of Iraq and the broader Middle East.

“If you think about it, the history of the region is a nightmare from which everyone is trying to awake,” Biden said.

Loveday Morris in Baghdad contributed to this report.