Image copyright Alamy

The number of people moving to the UK from EU countries was the lowest it has been for nearly four years in 2017.

But there was a rise in those coming from outside the EU, the Office for National Statistics said, with net migration the highest since 2011.

Overall net migration, the difference between the number of people coming to live in the UK for at least 12 months and those emigrating, was 282,000.

The government wants to cut overall net migration to the tens of thousands.

The ONS data is for the first full calendar year since the Brexit vote.

While the overall net migration was up by 33,000 on the previous year, statisticians said the figure was "broadly stable".

Media playback is unsupported on your device Media caption BBC examines the statistics of migration over decades across the world

The ONS figures showed there were 101,000 net migrants from the EU last year and 227,000 from outside the EU.

There was also a record number of EU citizens emigrating from the UK, with an estimated 139,000 leaving in 2017.

The only other year when the EU emigration figures came close to that level was in 2008 when 134,000 EU nationals left the UK.

The migration report also showed:

Net migration from eight eastern European countries that joined the EU in 2004 - Poland, Lithuania, Czech Republic, Hungary, Slovakia, Slovenia, Estonia and Latvia - has fallen from 42,000 in the year before the referendum to 6,000 in 2017

Net migration from 14 longer-term member states such as Germany, Italy, Spain and France, has almost halved since the vote, falling from 84,000 in the 12 months to June 2016 to 46,000 last year

An estimated 40,000 more Romanians and Bulgarians migrated to the UK than left last year - the joint lowest net migration figure for the two countries since the year to September 2014

The number of EU citizens coming to the UK "looking for work" decreased by a third (33%) from 55,000 in 2016 to 37,000 in the last year.

Meanwhile, those coming to the UK for a definite job remained stable, the ONS said.

"What these statistics show is that more of the people who are coming to the UK are coming for the reasons we would want - to take up a definite job or to study," immigration minister Caroline Noakes said.

While net migration is continuing to add to the UK population, the 2017 figure of 282,000 is down from record highs recorded in 2015 and early 2016.

It is the highest for 18 months, however - and still well above the government target of less than 100,000.

Analysis

By Danny Shaw, BBC home affairs correspondent

Last year, 240,000 people from European Union countries came to live in Britain. The number of EU migrants has been falling since June 2016 - the month of the referendum - and is now at a similar level to mid-2014.

At the same time, emigration of EU nationals from Britain has been steadily increasing and at 139,000 is the highest level on record.

The EU emigration figures are a function of the number of EU nationals living in Britain; there are some 3.5 million in the country, so it's to be expected that departure levels are higher now than in the 1970s, '80s and '90s.

Nevertheless, the fact they've risen so sharply would appear to be further evidence of the impact of the Brexit vote.

As for migration from countries outside Europe, 311,000 people arrived in the UK last year - back to levels last seen in 2011.

It suggests that even if the government takes greater control of EU migration after Brexit, the challenge of getting the right level of immigration from outside Europe remains.

Emigration has shown a gradual increase since 2015 and is currently around 350,000, the ONS said.

Immigration has stayed roughly stable at about 630,000, the report showed.

'Declining allure'

Lord Green of Deddington, chairman of Migration Watch UK, said the new figures were "very disappointing", adding: "It's time for the government to get serious about reducing immigration instead of caving into every demand of the immigration lobby."

Madeleine Sumption, director of the Migration Observatory at the University of Oxford, said the data suggests the UK is "still an attractive country, but its allure for EU migrants has declined considerably over the past couple of years".

Shadow home secretary Diana Abbott said it was "clear to almost everyone except Theresa May that the net migration target should go".

But the prime minister's official spokesman said: "We remain committed to bringing net migration down to sustainable levels, and that is the tens of thousands."