WASHINGTON — In his first extended interview since returning to the Senate after treatment for brain cancer, Sen. John McCain was his traditionally cantankerous self Sunday, criticizing President Donald Trump and other Republicans on issues such as illegal immigration and climate change, and calling for more bipartisanship to solve the nation’s problems.

In the latter, he did not include the president’s deal last week with Democratic leaders Rep. Nancy Pelosi of California and Sen. Charles E. Schumer of New York. McCain criticized Trump for ignoring the desires of Republican leaders and said the deal, which extended the debt ceiling and government funding until Dec. 8 and approved $15 billion in hurricane relief, locked in place “unconscionable” past cuts in military spending.

“The agreement that they made is basically devastating to national defense,” the Arizona Republican said on CNN’s “State of the Union.” He blamed recent accidents involving Navy ships — including one named after his father and grandfather, both celebrated admirals — on a lack of training and readiness caused by the spending cuts.

“Under this agreement, they not only don’t have everything they need, their lives are in greater danger. We can’t do that to them,” he said. McCain was one of 17 senators who voted against the deal last week.

McCain also addressed Trump’s action regarding the fate of young immigrants brought to this country illegally by their parents in the past.

The president last week rescinded the Deferred Action for Childhood Arrivals, or DACA, program, which protected those immigrants. The president delayed the end of the program for six months to allow Congress to consider a fix.

McCain has long advocated comprehensive immigration reform, and said it now must include protection for DACA beneficiaries.

“It is not conscionable to tell young people who came here as children that they have to go back to a country that they don’t know,” he said.

McCain has long differed with many in his party over climate change. Trump and other Republican leaders have denied that human actions are primarily responsible for changes in the climate and are affecting weather conditions. The destructive impact of Hurricanes Harvey and Irma has resurrected the debate inside the party and out.

“We have to understand that the climate may be changing and we can take common sense measures which will not harm the American people and our economy,” McCain said, citing nuclear and solar panel as appropriate alternatives.

The senator was remarkably upbeat about his own future despite his diagnosis with what he called a “very virulent” form of brain cancer. He said he will undergo tests this week to determine the effect of chemotherapy and radiation he received after surgery this summer that removed a tumor over his left eyebrow.

He said he had suffered no side effects — “except, frankly, an increased level of energy.”

“I’m very happy, I’m very happy with my life, with what I’ve been able to do,” he said. “There’s two ways of looking at this thing. ... I am able to celebrate a wonderful life and I will be grateful for additional time that I have.”

He said his prognosis so far was “pretty good” but acknowledged his long-term odds.

And he leaned on a bit of self-deprecation, which he has used for decades, including during his two campaigns for the presidency.

“You gotta have joy! Joy!” he said. “I’m the guy that stood fifth from the bottom of his class in the Naval Academy.”