A Romanian man should not have been fired for sending private messages at work, Europe's top human rights court has ruled.
Bogdan Mihai Barbulescu was sacked for sending the messages via the Yahoo messaging system in 2007.
His employer had used surveillance software to monitor his computer activity.
A Romanian court ruled in 2016 that the firm was within its rights but this has now been overturned.
Mr Barbulescu successfully challenged the original decision.
Some of the communications he had sent were "intimate in nature" and were sent to his brother and his fiancee, the court heard.
However, his right to privacy had not been "adequately protected", the apex body of the European Court of Human Rights (ECHR) has now ruled.
The ECHR also said it was not clear whether Mr Barbulescu had been warned that his communications would be monitored, and that the original court had not established specifically why the monitoring had taken place.
As it is the highest court there can be no further appeal.
- Employers 'can read private messages'
"...although it was questionable whether Mr Barbulescu could have had a reasonable expectation of privacy in view of his employer's restrictive regulations on internet use, of which he had been informed, an employer's instructions could not reduce private social life in the workplace to zero," said the court in its decision.
In a question and answer section on its website, the ECHR says the ruling does not mean that firms cannot now monitor employee communications at work, and that they can still dismiss employees for private use.
"However, the Court considers that States should ensure that, when an employer takes measures to monitor employees' communications, these measures are accompanied by adequate and sufficient safeguards against abuse," it said.
Catrina Smith, employment partner at the legal firm Norton Rose Fulbright said it would not have a huge impact on UK employment regulation.
"What it will do, for companies who thought they had a bit more leeway than they did, is confirm the fact that they don't," she said.
"It will hopefully remind employers that they need to think about these issues and be very clear with employees about what is and isn't permissible.
"Employees also need to be smarter about the way in which they use both personal and work devices."
Ms Smith added that in the UK both the Data Protection Act and the Interception of Communications Act set out clear guidelines for employers regarding what they can monitor.
"You have to make sure the employee understands that [monitoring] might happen and you have to have a good reason for doing so," she said.
"It's all about having a dialogue and having an agreement about what is and isn't personal."
There also needs to be clear guidelines about the use of personal devices for work purposes, she added.
"In the old days if you took papers home, they still belonged to the employer," she said.
"You need to have clear understanding of the amount of ownership an employer has over information held on a personal device."