German Chancellor Angela Merkel, center left, speaks with U.S. President Barack Obama, center right, during a group photo of G-7 leaders and Outreach guests at the G-7 summit at Schloss Elmau hotel near Garmisch-Partenkirchen, southern Germany, Monday, Ju

French President Francois Hollande, US President Barack Obama and Germany's Chancellor Angela Merkel, from left, arrive for a working session of the G-7 summit at Schloss Elmau hotel near Garmisch-Partenkirchen, southern Germany, Monday June 8, 2015. (Joh

US President Barack Obama, right, and French President Francois Hollande pose for a photograph prior to a bilateral meeting during the G-7 summit in Schloss Elmau hotel near Garmisch-Partenkirchen, southern Germany, Monday, June 8, 2015. (AP Photo/Carolyn

ELMAU, Germany (AP) — Despite setbacks that have raised doubts about his policy, President Barack Obama voiced optimism Monday that the Islamic State would be driven out of Iraq, but said the effort will take time and require an inclusive government in Baghdad.

Obama said the U.S. will continue to ramp up training and assistance to Iraqi troops so they can carry out offensive, not just defensive, operations.

"We have seen successes but we have also seen setbacks," Obama said at the beginning of a meeting with Iraqi Prime Minister Haider al-Abadi. Referring to the Islamic State by one of its acronyms, Obama added: "ISIL is going to be driven out of Iraq and ultimately it is going to be defeated."

Obama and Abadi spoke on the sidelines of a meeting of leaders of the Group of Seven industrialized economies.

The session with Abadi came just a day after an Iraqi general declared that Iraqi troops, backed by Shiite militias, had recaptured key parts of the northern refinery town of Beiji from the Islamic State. The news was a welcome change of pace for the U.S. after Islamic State militants won a major victory by capturing the city of Ramadi, the capital of Iraq's Anbar province.

Abadi thanked Obama and G-7 members for standing with Iraq against the Islamic State. He said Iraqi troops were winning a number of battles and downplayed Ramadi's loss. "We lost it only temporarily," he said.

Obama also expressed confidence in Abadi's leadership, saying the prime minister appeared committed to creating an inclusive government that gave voice to the various factions in Iraq.

"There's a refreshing honesty in the part of the prime minister that a lot of work needs to be done," Obamasaid.

Obama on Monday sought not only to address pressing Mideast problems, but also to convince European leaders to maintain sanctions against Russia in the face of fresh violence in Ukraine.

Obama participated in the final day of the G-7 summit under the strain of an intimidating list of global pressures and little signs of movement to address them among the world's largest industrial democracies. Climate change and terrorism topped the official agenda, but leaders also grappled with Russia's aggressive moves on Ukraine, an upcoming nuclear deadline with Iran, tenuous trade pact politics and an impasse over Greece's international bailout.

Obama met privately with French President Francois Hollande, a sometimes skeptical partner in the talks with Iran over its nuclear weapons program.

Among the issues they discussed, the two leaders agreed to stay united in pursuit of a comprehensive agreement with several other world powers to keep Iran from obtaining a nuclear weapon, the White House said. They also agreed that sanctions against Russia should remain until the Kremlin fully abides by a peace agreement with Ukraine.

Obama and Hollande also discussed climate change, the threat from Islamic State militants, trade and instability in Libya.

White House press secretary Josh Earnest said Obama wants to look for "more efficient ways that we can offer assistance to Iraqi security forces" and he expects that will be part of the discussion among the G-7, which also includes Britain, France, Germany, Italy, Canada and Japan.

Meeting on Sunday with British Prime Minister David Cameron, Obama said he wanted to address the fight against the Islamic State in Iraq and Syria and "assess what's working, what's not, and how we can continue to make progress there in dismantling the infrastructure that ISIL has built."

On another battlefront, in Ukraine, Earnest said Obama was urging European leaders to renew sanctions against Russia that are set to expire at the end of July. Obama wants the Europeans to leave the financial penalties in place until Moscow complies with the terms of a cease-fire agreement reached four months ago in Belarus. Some of the worst fighting since the cease-fire was agreed to broke out last week in eastern Ukraine.

"Russia has essentially thumbed their nose at the commitments that they made in the context of the Minsk negotiations," Earnest said. He urged Europeans to stay the course, while acknowledging it could cause financial pain because their economies are tied to Russia.

___

This story has been corrected to note that Obama commented at the beginning of his meeting with Abadi, not at the end.

A San Diego judge called an adult man a "little boy" in his courtroom, repeatedly noted the physical attractiveness of female attorneys and spoke to litigants in Spanish based on their surnames, among other misconduct that nearly led to his removal from office, a state disciplinary agency said Thursday.

A San Diego judge called an adult man a "little boy" in his courtroom, repeatedly noted the physical attractiveness of female attorneys and spoke to litigants in Spanish based on their surnames, among other misconduct that nearly led to his removal from office, a state disciplinary agency said Thursday.

An international team of veterinarians is in Ukraine helping hundreds of dogs at the site of the Chernobyl nuclear plant disaster. One of the vets is from San Diego and spoke with News 8 via Skype while on a mission of mercy.

An international team of veterinarians is in Ukraine helping hundreds of dogs at the site of the Chernobyl nuclear plant disaster. One of the vets is from San Diego and spoke with News 8 via Skype while on a mission of mercy.

The captain of a Navy warship that lost seven sailors in a collision with a commercial container ship in June will be relieved of command and nearly a dozen others face punishment, the Navy's second-ranking admiral said Thursday.

The captain of a Navy warship that lost seven sailors in a collision with a commercial container ship in June will be relieved of command and nearly a dozen others face punishment, the Navy's second-ranking admiral said Thursday.