Emma Watson must be wishing she could make the Panama Papers disappear.

The actress, who played wizard Hermione Granger in the Harry Potter series, set up an offshore company using Mossack Fonseca, the law firm at the center of the leak, newly released data show.

Watson's spokesman Luke Windsor said the actress set up the company to protect her safety, and does not gain any financial benefit or tax advantage from the move.

"Emma (like many high profile individuals) set up an offshore company for the sole purpose of protecting her anonymity and safety," Windsor said in a statement emailed to CNNMoney.

Windsor said that companies in the U.K. are required to publish details of their shareholders and "therefore do not give her the necessary anonymity required to protect her personal safety."

Related: Panama Papers source comes forward

He said Watson's safety has been jeopardized in the past when such information became public. Offshore companies, such as the one Watson set up, do not publish shareholder details.

Some U.K. media reported that the actress had set up the company to buy a property in London. Watson's spokesman declined to comment.

British newspaper The Spectator first found Watson's name in a public database of individuals and entities that have alleged links to Mossack Fonseca. The database, released by the the International Consortium of Investigative Journalists, details ties between 368,000 people and nearly 320,000 offshore entities.

It is based on a leak of over 11 million documents from the Panama-based law firm.

Panama Papers: 7 things to know

According to the leaked data, Watson set up a company called Falling Leaves Ltd in 2013 in British Virgin Islands. The U.K. overseas territory in the Caribbean has been identified by the European Commission as a tax haven.

There are many legitimate reasons for opening an offshore bank account. Wealthy people do it to better manage their investment portfolios or protect their assets. Offshore accounts can also help the rich pay less tax -- legally.