Immigration should rise and fall depending on the UK's needs after it has left the EU, the Brexit secretary says.

David Davis said a "sustainable" system would take into account the needs of the NHS and different industries.

He also said the government had a "huge contingency plan" for the UK leaving the EU without a deal.

Mr Davis was speaking on a special edition of BBC Question Time ahead of Wednesday's formal Brexit notification.

The government has yet to specify how the UK's immigration system will work once it is no longer bound by EU free movement rules, but has promised to restore "control" to borders with new curbs in place.

Mr Davis said the new system would be "properly managed".

It would be for the home secretary to decide the system to be used, he said, but added: "I cannot imagine that the policy will be anything other than that which is in the national interest.

"Which means that from time to time we will need more, from time to time we will need less.

"That is how it will no doubt work and that will be in everybody's interests - the migrants and the citizens of the UK."

The Brexit secretary was urged by a German NHS worker in the audience to "do the decent thing" and guarantee EU nationals the right to stay in the UK.

He promised the issue would be a priority when talks begin.

'Nonsensical'

On Wednesday Prime Minister Theresa May will invoke Article 50 of the Lisbon Treaty, which begins the negotiation process.

During the Britain after Brexit debate the panellists, who included former Scottish first minister Alex Salmond and Labour Brexit spokesman Sir Keir Starmer, were asked what would happen if no deal was reached.

Mr Davis said the government had spent the nine months since June's Brexit vote preparing a plan.

He said it was not a scenario the government wanted to see, but added: "We have got a huge contingency plan, exercised across all of these issues, every department of government."

Mr Salmond said the government's view that no deal is better than a bad deal was "nonsensical".

But UKIP's Suzanne Evans criticised "hyperbole" about "crashing out" of the EU.

Mr Davis also said the UK would abide by its obligations when it comes to settling outstanding liabilities with the EU, but played down claims these could amount to £50bn.

Former Lib Dem leader Nick Clegg said the EU was "simply going to ask us to settle the tab before we leave", and Mr Starmer said the UK had to honour its debts "otherwise no country is going to want to deal with us" in future trade negotiations.

But a man in the audience compared the EU's demands with "the bully in the playground taking our lunch money".

On Wednesday, the prime minister will send a letter to the president of the European Council telling him officially that the UK wants to leave.

Triggering Article 50, the letter will set in motion a two-year process in which the terms of the UK's departure from the EU will be hammered out, as will the outline of the UK's future relationship with the remaining 27 EU members.

As things stand, the UK is set to leave the EU on 29 March 2019 although this deadline could be extended if both sides agree.

More than 33.5 million people voted in a referendum last June on the UK's future in the EU. They voted to leave by a margin of 51.9% to 48.1%.