In a ruling which could have far-reaching consequences for how the European Union deals with migrants in future, the European Court of Justice on Wednesday upheld the right of member states to deport asylum-seekers to the first EU country they enter.

The ruling amounted to an effective rejection of Angela Merkel’s controversial “open-door” refugee policy, which saw more than one million asylum-seekers flood into Germany.

The court ruled that the EU’s Dublin regulations, under which refugees must seek asylum in the first member state they enter, still apply despite the unprecedented influx of 2015.

In doing so, the court ignored the advice of Eleanor Sharpston, its British advocate-general, who warned that the system could leave border states “unable to cope”.

The court ruled on the cases of two Afghan sisters and a Syrian man who entered the EU during the 2015 crisis.

The Jafari sisters, Khadija and Zainab, entered the EU through Croatia after fleeing Afghanistan with their children. At the time, Mrs Merkel had opened Germany’s borders to migrants and Austria was operating a similar policy.

Croatia allowed the sisters and their children to cross its territory in order to reach one of the two countries.