Image caption Home Office staff have been told to watch what they say on social media

Home Office staff and contractors working for the department have been warned not to post negative comments about Donald Trump on social media.

Staff working at the department's digital data and technology unit were told last week that some of their Twitter comments were "not compliant".

According to The Register, staff were warned to be "careful" and comply with civil service guidance on impartiality.

The US president is expected to make a state visit to the UK later this year.

Many MPs have been critical of the invitation extended by Downing Street so early in Mr Trump's presidency while Commons Speaker John Bercow has said he does not support the US president addressing Parliament during the occasion, citing his travel ban and comments he has made about women.

However, Prime Minister Theresa May - a former home secretary - has insisted that the visit is vital to cementing the long-standing special relationship between the two countries as the UK embarks on leaving the European Union.

'Easier to understand'

In an e-mail obtained by The Register technology news website, and seen by the BBC, Home Office staff have been warned to "avoid commenting on politically controversial issues" in general and "giving personal opinions about the organisation".

They were reminded the Home Office's social media guidance had been updated and that they, as well as temporary employees and contractors, must observe the rules on not sharing information about the work of the department or saying they work for the Home Office on personal accounts.

Image caption The US president is no stranger to tweeting himself

It read: "A quick look through just a couple of known personal Twitter accounts of staff members shows that some are not compliant, stating that they work for the Home Office, posting HO work, whilst tweeting or retweeting negative posts about, for example, Donald Trump.

"We need to be careful here and ensure all our staff are following this guidance which reflects the Civil Service Code."

The Home Office told the Daily Telegraph that it did not comment on internal correspondence but a spokesman told the newspaper that all staff were expected to adhere to the values and standards of behaviour set out in the code.

"This includes the need for political impartiality and also applies to the use of social media," it added. "We recently updated our guidance on the use of social media by staff to make it clearer and easier to understand.

"This is in line with the Cabinet Office's guidelines and the changes have been communicated to all staff."

The Home Office employs more than 25,000 staff.