Boris Johnson will pass a law protecting EU citizens' rights to stay in the UK in the event of no-deal as one of his first acts in power.

The prime minister is understood to have approved the proposal with his cabinet at their inaugural meeting this morning.

Campaigners say more than three million EU citizens living in the UK have faced uncertainty about their rights in the event no agreement with the EU is passed.

Addressing MPs for the first time today, Mr Johnson said he would give EU citizens "absolute certainty" of their rights to stay in the UK and confirmed that this would mean a "guarantee in law".

Behind the scenes: PM's first cabinet

:: Meet Boris Johnson's new-look cabinet


Mr Johnson's commitment was confirmed to Tory MP Alberto Costa yesterday, following "a number of meetings" on the issue.

Mr Costa told Sky News: "Boris Johnson's government will enshrine EU citizens' rights in primary legislation, which is what I've been calling for to give them certainty.

"This is what EU countries have been looking for in order to give reciprocal rights of British citizens in Europe, in the event of no-deal.

"I've been campaigning on this for two-and-a-half years.

"Theresa May promised to do this but it wasn't in legislation, so I'm pleased Boris Johnson is going to take it up as he indicated on the steps of Downing Street."

Rees-Mogg: 'The sun will be shining'

Mr Johnson offered scant detail in the Commons about what his proposals would entail.

The Home Office has set up a scheme for EU nationals who have been in the UK for five years to apply for settled status by 2021, under the provisions of the withdrawal agreement.

If there is no deal, there will be less time: the government says EU citizens and their families who are resident in the UK by the deadline of 31 October will be welcome to stay, and have until mid-2020 to apply.

But efforts to agree this with the EU have stalled.

Campaigners say these protections are not legally binding and that some EU countries are looking for a legal guarantee if they are to only protect British citizens rights to stay in Europe.

During his leadership campaign, Mr Johnson repeatedly expressed his intention to protect the rights of EU citizens in the UK unilaterally, whatever the outcome of the negotiations.

In his first speech to the nation outside Downing Street yesterday, he said: "There is much in this withdrawal agreement that we can keep. Notably the work that gives certainty to millions of citizens on either side of the Channel.".

MPs passed a change to the law in February, with the support of many Conservative Brexiteers, demanding that the issue of citizens' rights is dealt with. It was known as the Costa amendment, but was dependent on EU agreement.

Brexit secretary Stephen Barclay raised the issue in correspondence and meetings with the EU's chief negotiator Michel Barnier, but Brussels rejects attempts to reach "mini deals" - preferring that the UK passes the withdrawal agreement.

Mr Barnier has said there are other problematic issues to be resolved, including the role of the European Court of Justice in guaranteeing these rights.

The government is now dependent on reaching reciprocal agreements with individual EU countries to give certainty to citizens living in the UK and EU when free movement of people ends.

Bilateral deals with Spain and Luxembourg to guarantee the voting rights of British citizens were reached this year. Separate deals on healthcare rights are also being sought.

Sky News has reported on the uncertainty facing EU citizens in the UK and British expats earlier this year - a situation described as a potential "new Windrush scandal".