MOSCOW — The Russian lawyer who met with Donald Trump Jr. last year after his father had won the Republican nomination for president had once represented Russia’s top intelligence agency in court, according to at least two public records.

The lawyer, Natalia V. Veselnitskaya, who is now at the center of the political intrigue over President Trump’s possible collusion with Russia during his presidential campaign, represented a military unit founded by the Russian Federal Security Service in 2002, publicly available records show.

The service, known as the F.S.B., is the successor agency to the K.G.B. and was once headed by President Vladimir V. Putin.

Ms. Veselnitskaya insisted after her June 2016 meeting with Mr. Trump’s son was first reported by The New York Times a few weeks ago that she had no ties to the Kremlin and never worked for the Russian government. A Kremlin spokesman, Dmitri S. Peskov, has said Ms. Veselnitskaya “has nothing to do with us.”

Still, the court documents showing the lawyer’s link to the Russian spy agency, which was first reported by Reuters, are likely to intensify interest in her by American investigators who are examining the relationships between the Trump campaign and Russia.

The documents concern a complex property dispute that dates back to at least 2004, when the Russian state fought against the private owners of an office building in northwest Moscow.

The building was privatized in 1991, when much of the state’s vast property holdings were transferred to private hands in the aftermath of the Soviet Union’s collapse.

But after Mr. Putin ascended to power at the end of 1999, the Russian government began to question some outcomes of the often-chaotic privatization.

In 2006 a court in Moscow ruled that the building should be transferred back to the state. One year later, Russia’s Federal Property Agency transferred the management of the building to Military Unit 55002, court records show.

According to the public registry, Military Unit 55002 was founded by the F.S.B. in 2002. It is officially registered in a building that stands in front of the iconic former headquarters of the K.G.B. in central Moscow and is populated by the intelligence agency’s branches.

The private owners appealed the court’s decision several times and were successful at least once. However, in the last record available on the case, a court rejected their appeal to keep the property in 2012.

The F.S.B.’s military unit participated in the legal wrangling as of 2011, and the court records show Ms. Veselnitskaya was its legal representative.

It is not clear whether the F.S.B. uses the building now, or if it is rented out to other tenants.

The F.S.B.’s predecessor agency, the K.G.B., is where President Putin began his career in the 1970s.

President Trump’s eldest son agreed to a meeting with Ms. Veselnitskaya after she was described as a Russian government lawyer who had obtained incriminating documents about Hillary Clinton, Mr. Trump’s Democratic challenger.

The meeting was set up by Rob Goldstone, a British music publicist, who said in an email to Donald Trump Jr. that Ms. Veselnitskaya had obtained the documents from the top Russian prosecutor.

Ms. Veselnitskaya has since said she never had damaging information about Mrs. Clinton, and President Trump has said he only learned about the meeting a few days before The Times reported it. But he also has defended his son’s decision to hold the meeting and described it as simply politics.