US Senator John McCain, diagnosed with an aggressive form of brain cancer, was given a hero’s welcome on his return to the Capitol, but quickly seized the opportunity to hit out at his party and his president for partisan politics.

Mr McCain spoke at length on the Senate floor, delivering a passionate rebuke of his fellow Republicans in Congress and an administration that has shown few results during President Donald Trump's first six months in office.

"We're getting nothing done," the 80-year-old senator said.

Mr McCain made a return from his Arizona home to cast a critical vote to keep alive one of Mr Trump’s top legislative priorities, the repeal of 2010's Obamacare law, formally known as the Affordable Care Act.

Mr McCain entered the Senate chamber to a standing ovation, with his vote helping Republicans open a floor debate, setting the stage for them to fashion a legislative replacement for Obamacare.

The vote was narrowly agreed, but the party's seven-year effort to roll back Obamacare still faces significant hurdles.

The senator criticised the process through which Republicans have crafted their healthcare legislation, shutting out Democrats and writing the bill out of public view.

While Democrats did little better in 2010, Mr McCain said, "We shouldn't do the same with ours."

He called on the Senate to make a renewed commitment to bipartisanship.

"I hope we can again rely on humility, on our need to cooperate, on our dependence on each other to learn how to trust each other again and by so doing better serve the people who elected us," Mr McCain said.

"Stop listening to the bombastic loudmouths on the radio and television and the internet. To hell with them. They don’t want anything done for the public good."

Earlier this month, after surgery to remove a blood clot above his eye, McCain was diagnosed with a primary glioblastoma, a highly aggressive type of brain tumour. He has been discussing treatment options with his medical team.

He said he would remain in Washington for a few days before returning to Arizona for treatment.

Tonight's vote was a huge relief for President Trump, who had pushed his fellow Republicans hard in recent days to live up to the party's campaign promises to repeal Obamacare.

Minutes after the vote, Mr Trump called it "a big step."

Separately, the US House of Representatives voted overwhelmingly to impose new sanctions on Russia, Iran and North Korea, despite President Trump's objections to the legislation.
           
As voting continued, House members backed the measure by a margin of 388-2, with strong support from Mr Trump's fellow Republicans as well as Democrats.

It must pass the Senate before it can be sent to the White House for Mr Trump to sign into law or veto.
           
Senate leaders have not said when they might consider the House bill.

The White House said the president had not yet decided whether he would sign the measure.