U.S. Secretary of State John F. Kerry, left, and Iraqi Foreign Minister Ibrahim al-Jafari sit in the library at the foreign minister’s villa in Baghdad on April 8. (Jonathan Ernst/AP)

Secretary of State John F. Kerry said Friday that Islamic State fighters are on the run in Iraq, and he vowed to amp up pressure on the group in coming weeks.

Kerry, who made an unannounced day-long stop in the country’s capital, said Iraqi officials made no requests for additional U.S. troops beyond the 3,870 on the ground. He announced $155 million in U.S. aid, primarily for humanitarian projects aimed at Iraqis who are displaced and hungry.

But Kerry’s central message was that the Iraqi government, reeling from political and economic instability, needs to forge ahead in its offensive to wrest territory back from Islamist militants.

“Daesh unequivocally is losing ground,” Kerry told reporters, ­using an acronym for the Islamic State, after a series of meetings with Iraqi officials in the fortified Green Zone. “It’s losing leaders, it’s losing fighters, it’s losing cash. Now, some of its fighters are losing hope.”

During his stay of about seven hours, Kerry met with embattled Prime Minister Haider al-Abadi and Foreign Minister Ibrahim al-Jafari. He also met with Nechirvan Barzani, prime minister of the Kurdistan Regional Government, and the Iraqi speaker of parliament, Salim al-Jubouri.

His arrival was cloaked in secrecy. He left his blue-and-white official plane, emblazoned with the words “United States of America,” in Bahrain, where he had met with gulf officials on Thursday, and flew to Baghdad on a U.S. Air Force C-17. A military helicopter ferried him to the U.S. Embassy compound on the edge of the Green Zone, where many embassies and the prime minister’s palace are located. Kerry never left the Green Zone.

Since Kerry last visited Iraq 19 months ago, shortly after Abadi took office, Iraq’s travails have increased exponentially, and Abadi’s support has weakened.

The country is practically bankrupt, thanks to the collapse of oil prices and rampant corruption that is said to have drained billions of dollars from state ­coffers. For months, the streets have often been filled with crowds of protesters unhappy over corruption and a lack of basic services, such as clean water and reliable electricity.

The firebrand Shiite cleric ­Moqtada al-Sadr, whose militia once squared off against U.S. troops, has become a leader of the once-secular protests. Sadr ­pressured Abadi to announce a new cabinet of technocrats, and Jafari, who Kerry met with on Friday, would be one who would leave his post if the cabinet is approved by parliament. But many political factions have ­complained that they were not consulted and oppose the new cabinet appointments, so it is unclear whether it will be accepted.

Secretary of State John F. Kerry arrives via military transport at Baghdad International Airport in Iraq on April 8. (Jonathan Ernst/AP)

After a series of battlefield ­victories by the Iraqi army, the Islamic State has lost an estimated 40 percent of the area it once controlled in the country. But it still occupies a wide swath of territory. A long-anticipated ­offensive to take back the northern city of Mosul, Iraq’s second-largest city, had barely begun before it stalled.

The host of problems has caused great concern in the State Department. Vice President Biden called Abadi recently, ­reaffirming U.S. support for the beleaguered prime minister.

Kerry came to Baghdad to urge Abadi not to allow Baghdad’s ­domestic tribulations to sap the campaign against the Islamic State, also known as ISIL or ISIS, which the Iraqi army already has ousted from Tikrit and Ramadi.

“We will not be complacent at any point in this campaign,” Kerry said. “In the coming weeks and months, we will work with Iraq to turn up the pressure further.”

A senior official, speaking on the condition of anonymity under State Department rules for briefing reporters, said the administration thinks the Iraqi military has grown more proficient since the Islamic State took Mosul in 2014. But falling prices for oil, the mainstay of the Iraqi budget, have made it difficult to maintain the military momentum.

The official said a main part of Kerry’s message was “to encourage the Iraqis while they’re dealing with the cabinet reshuffle not to lose sight of the need to stay focused on the fight against ISIL.”