During his year-end news conference, President Barack Obama took the kinds of partisan shots that for years have so frustrated congressional Republicans. But he also flashed the pragmatic streak that helped him notch several legislative victories in 2015.

On one hand, Obama praised Republicans for crafting several high-profile bills that met his muster. But on the other, he clubbed the GOP for bucking the rest of the world for its rejection of the very concept of climate change. The president and Capitol Hill Republicans have had a rocky relationship since even before he took office in January 2009, and the bad blood has made Washington a symbol of legislative dysfunction ever since. But the ill will seemed to dissipate a bit this year, as he signed into law sweeping bills on education, highways, the Export-Import Bank, and a massive spending bill that raises defense and domestic budget caps and also averts a government shutdown.

Each measure was sent to him by a House and Senate controlled by Republicans. Obama even thanked Congress for “ending the year on a high note,” a shoutout that would have been unthinkable several years ago.

Some pundits and GOP lawmakers have dubbed Obama a lame duck president who will be challenged to check many more items off his legislative to-do list, but the president used words like “optimistic” and “hopeful” to describe his outlook for working with congressional Republicans during his final year in office.

“Congress and I have a long runway to get important things done on behalf of the American people,” said Obama, his hair now almost completely gray and wrinkles on his face more noticeable than when he took office. “There's still a lot of work to do.

“For example, there's still a lot more that Congress can do to promote job growth and increase wages in this country,” he said. “I still want to work with Congress, both Democrats and Republicans, to reform our criminal justice system.” Also on his final legislative wish list: Congressional approval of a sweeping trade pact with Asian nations. Obama wants it approved next year; Senate Majority Leader Mitch McConnell, R-Ky., says it should wait until a new president is in office.

From the moment he stepped into the White House press briefing room, the president seemed focused on leaving Washington for his annual Hawaii holiday vacation by setting up what could be, for a presidential election year, a robust legislative agenda.

“In short for all the very real progress America's made over the past seven years, we still have some unfinished business,” Obama said. “And I plan on doing everything I can with every minute of every day that I have left as president to deliver on behalf of the American people.”

Labeled by political observers as cerebral and calculating, the president started the briefing upbeat, joking about a need to be “relatively succinct” because children and family members who lost loved ones in the Iraq war were due at the executive mansion for a screening of the new “Star Wars” movie.

He quickly segued into a downright upbeat 2015 legislative victory lap and 2016 pep talk that, at times, sounded like a eulogy for the era of Washington dysfunction.

“Since taking this office, I have never been more optimistic about a year ahead than I am right now,” he said. “And in 2016, I'm going to leave it out all on the field.”

There were kind words for the new Republican House speaker, Paul D. Ryan of Wisconsin, whom Obama described as a candid and trustworthy negotiator during the recent omnibus spending talks. Likewise for Ryan’s predecessor, the now-retired Rep. John A. Boehner, R-Ohio, whom Obama said did everyone a “favor” by striking the framework spending deal that set spending levels for the omnibus.

But the news conference wasn’t all Obama reaching across the aisle with platitudes for deeds done and fig leafs for help on things he wants to do before leaving the White House. He took a few parting shots at the opposition party.

For instance, Obama criticized the GOP for being, as he put it, the only major political party in the world that believes climate change is not real.

A day after House Majority Leader Kevin McCarthy, R-Calif., issued a statement declaring that chamber is busy “dismantling Obamacare,” the president used his opening remarks to tout his health care overhaul.

“Years of steady implementation of the Affordable Care Act helped to drive the rate of the uninsured in America below 10 percent ... for the first time since records were kept on that. Health care prices have grown at their lowest level in five decades,” he said. “Seventeen million more Americans have gained coverage, and we now know that 6 million people have signed up through healthcare.gov for coverage beginning on January, 1st — 600,000 on Tuesday alone."

McCarthy and other Republicans see the law differently, with the majority leader on Thursday calling it an “unmitigated disaster” that has spawned “increasing premiums, limited provider networks, lost health plans, [and] failing co-ops.”

And the president set up a potential brawl with Republicans next year by refusing to rule out using his executive authorities to close the terrorist detention facility at Guantanamo Bay, Cuba.

Obama said he still intends to submit a closure plan to Congress next year, a proposal that has been delayed due to cost concerns for housing current Guantánamo detainees in the United States. He vowed that the White House will wait for Congress to review that plan before his administration announces whether it will indeed use executive action to shutter the facility, but acknowledged he faces an “uphill battle” convincing Republicans to support it.

He previewed an argument the White House likely will make as it pushes to close the prison, saying he hopes to continue shrinking its population below the current level of around 100 prisoners. Obama said he believes it will make little fiscal sense to continue spending hundreds of billions of dollars annually to house perhaps only around 70 prisoners there as more are transferred to other countries.

But going it alone could create major political and legal fireworks. That’s because Senate Armed Services Chairman John McCain, R-Ariz., who supports Obama’s push to convince Congress to shutter the facility, has threatened to sue the president if he moves forward under his executive powers.

Still, even while challenging Republicans, Obama’s pragmatic and suddenly “optimistic” side shone through: "I think it's far preferable if I can get stuff done with Congress,” he said with a slight grin. “Sometimes they'll surprise you.”