BRUSSELS (Reuters) - The European Union and the United States have clinched a deal protecting personal data shared for law enforcement purposes such as terrorism investigations, according to a document seen by Reuters.

An EU flag and an U.S. flag are pictured in front of the German Finance Ministry in Berlin December 6, 2011. REUTERS/Tobias Schwarz

The two sides have been negotiating for four years over the so-called “umbrella agreement” that would protect personal data exchanged between police and judicial authorities in the course of investigations, as well as between companies and law enforcement authorities.

However, talks have been hampered by the lack of a right for non-resident EU citizens in the United States to go to U.S. courts if they believe their data has been misused or unlawfully disclosed.

U.S. citizens enjoy such rights within the EU.

The text of the agreement has been finalized, according to the document. A person familiar with the matter said it will be initialed by the chief negotiators in Luxembourg on Monday or Tuesday. That would signal the end of talks.

The European Commission has said the agreement cannot be signed and formally concluded until the “right to judicial redress” for EU citizens is enshrined in U.S. law.

In March, U.S. Congressman Jim Sensenbrenner introduced the Judicial Redress Act, aimed precisely at giving citizens of U.S. allies the right to sue over data privacy in the United States.

The document says the bill appears to have received bipartisan support, and if passed would restore trust in frayed trans-Atlantic relations after allegations of mass U.S. spying emerged in 2013.