Image copyright AFP/Getty Image caption Thousands marched through London on 21 January to voice their opposition to President Trump

Downing Street has rejected calls to cancel President Donald Trump's proposed state visit to the UK after a US clampdown on immigration.

A source said a rejection would be a "populist gesture", adding that the invitation had been accepted and scrapping it would "undo everything".

Labour leader Jeremy Corbyn said PM Theresa May would be failing the people if she failed to postpone the visit.

A petition to stop it has gathered more than 900,000 signatures since Saturday.

Only 100,000 signatures are needed for Parliament to consider debating a petition.

The visit was announced during PM May's trip to the US - no date has been set but it is expected to take place later this year.

However, on Friday Mr Trump signed an executive order halting the US refugee programme for 120 days, indefinitely banning all Syrian refugees and suspending the entry of all nationals from seven Muslim-majority countries.

Moves to implement the measure have triggered anger and protest across the world.

Buckingham Palace has declined to comment on the row.

The Downing Street source told the BBC: "America is a huge important ally. We have to think long term."

But Shadow Attorney-General Shami Chakrabarti said the government's position "sounds like appeasement".

Mr Corbyn, who has urged followers to support the petition, tweeted on Sunday: "@Theresa_May would be failing the British people if she does not postpone the state visit & condemn Trump's actions in the clearest terms."

"@realDonaldTrump should not be welcomed to Britain while he abuses our shared values with shameful #MuslimBan & attacks on refugees & women," he added.

Liberal Democrat leader Tim Farron backed the call. He said: "Any visit by President Trump to Britain should be on hold until his disgraceful ban comes to an end.

"Otherwise Theresa May would be placing the Queen in an impossible position of welcoming a man who is banning British citizens purely on grounds of their faith."

Image copyright Getty Images Image caption Protesters have gathered at airports across the US to demonstrate against the executive order

Alex Salmond, the SNP's foreign affairs spokesman, said he thought the state visit was "a very bad idea".

Also appearing on Sky News' Sophy Ridge, he said: "You shouldn't be rushing into a headlong relationship with the President of the United States."

Mr Salmond said reports Mr Trump was reluctant to meet Prince Charles during the visit were "an indication of the sort of enormous difficulties you get into when you hold somebody tight who is unpredictable, who has a range of views you find unacceptable."

And Mayor of London Sadiq Khan said the visit should not happen while the executive order was in place.

He told Sky News: "I am quite clear, this ban is cruel, this ban is shameful, while this ban is in place we should not be rolling out the red carpet for President Trump."

Leeds solicitor Graham Guest, who started the petition, said he wanted it to "put the spotlight" on Mr Trump.

He told the Press Association: "A state visit legitimises his presidency and he will use the photo opportunities and being seen with the Queen to get re-elected.

"The wording in the petition is quite precise as I actually say that he should come here as the head of government to do government-to-government business.

"At the end of the day he is still the president and we've just got to live with that. But there's no reason why he should get all the pomp and publicity of a state visit."

'British values first'

Former shadow cabinet member Chuka Umunna also backed the calls to cancel the trip.

"State visits happen at the instigation of governments and, of course, you have got a prime minister who you want to have a decent working relationship with a US president.

"But they need to understand, just as they will put America first, we will put British values first."

Ruth Davidson, leader of the Scottish Conservatives, said she hoped Mr Trump would reconsider his position on immigration "immediately".

"State visits are designed for both the host, and the head of state who is being hosted, to celebrate and entrench the friendships and shared values between their respective countries," she said.

"A state visit from the current president of the United States could not possibly occur in the best traditions of the enterprise while a cruel and divisive policy which discriminates against citizens of the host nation is in place."

Paddy Ashdown, former leader of the Liberal Democrats, questioned the state visit on Twitter.

He wrote: "Am I alone in finding it impossible to bear that in pursuit of her deeply wrong-headed policies our PM is now forcing THAT MAN on our Queen?"

Conservative MP for Totnes, Sarah Wollaston, earlier tweeted that the US President should not be invited to address the Houses of Parliament, saying Westminster Hall "should be reserved for leaders who have made an outstanding positive difference in the world".