A lawyer for alleged Russian agent Maria Butina filed a motion Friday arguing that federal prosecutors misconstrued a three-year-old playful exchange between Butina and a male friend in Russia to smear the 29-year-old student as a seductress who offered sex for access.

Attorney Robert N. Driscoll also argued that Butina should be released from jail, where she has been held since she was arrested July 15 and charged with working to infiltrate the National Rifle Association and other conservative political groups as an unregistered agent of Russia.

Butina was ordered held without bond pending trial by U.S. Magistrate Judge Deborah A. Robinson of Washington, who cited risks that Butina might flee or resume her alleged unlawful activities, as well as the government’s significant evidence against her.

Last week, Butina was moved from the D.C. jail to another facility in Alexandria, Va. The Russian Embassy in Washington had complained about the ­conditions in which she was being held.

Prosecutors have argued that Butina, who moved to the United States in August 2016 to attend a graduate program at American University, was a flight risk with deep ties to Russia and whose U.S. connections were based on “deception.”

In court papers, they argued that her romantic relationship with a 56-year-old American political operative was “duplicitous” and that she had at least once offered sex to someone else “in exchange for a position within a special interest organization.” Prosecutors said she also had expressed “disdain” about having to live with the operative, who has been identified as South Dakota-based consultant Paul Erickson.

The evidence that prosecutors turned over to the defense to support those claims showed that they were nothing more than a “sexist smear,” Driscoll wrote, adding that they were designed to “gratuitously and falsely” impugn her reputation.

Driscoll wrote that the claim that Butina had offered sex for a position leans on a 2015 joking text exchange between Butina and a Russian man.

The man was a longtime friend who did public-affairs work for the Russia gun rights group Butina founded and had taken Butina’s car in Russia to get its insurance renewed as a favor, according to Driscoll.

“I don’t know what you owe me for this insurance[.] They put me through the wringer,” the man wrote to her in Russian, according to the filing.

“Sex,” she responded, adding: “Thank you so much. I have nothing else at all. Not a nickel to my name.”

Later, she wrote, “Ask for anything,” adding: “That they hire you?” — a joking reference, Driscoll wrote, to the fact that Butina’s group already employed the man.

“Think of something!!” he replied. “Sex with you does not interest me.”

Butina was close friends with the man’s wife and child, and the exchange was “nothing more than a long-running joke between old friends,” Driscoll wrote, adding that their banter included no promise of a job in exchange for the sex.

“The impact of this inflammatory allegation, which painted Ms. Butina as some type of Kremlin-trained seductress, or spy-novel honeypot character, trading sex for access and power, cannot be overstated,” he wrote.

Butina is being prosecuted by the U.S. attorney’s office in Washington, which has not yet responded to the filing. A spokeswoman for the office declined to comment. Judge Tanya S. Chutkan indicated Friday that she would address the bond issue during a Sept. 10 status conference ordered in the case.

Driscoll also argued that the prosecution’s evidence that Butina had expressed disdain about Erickson is based solely on a 2015 text exchange with a female friend who had complained about her own boyfriend.

In a chain replete with emoticons and cat pictures, Butina responded that Erickson had been “bugging” her about his mother, causing her to feel like she was “residing in a nursing home,” the filing said.

“Three-year old, offhand complaints about one’s romantic partner being too close to their mother should be out of bounds, and certainly not asserted to be proof of a ‘duplicitous’ relationship,” Driscoll wrote.

The Russian Embassy has campaigned extensively on Butina’s behalf, calling her arrest politically motivated, complaining about her jail conditions and promoting the hashtag #FreeMaria.

Driscoll argued that Butina should be freed to home detention, noting that the activities for which she is charged were not covert and involved no collection of sensitive information. There is no evidence, he wrote, that she was ever funded by the Russian government.

On Thursday, prosecutors filed with the court a letter they had written to Driscoll, complaining that comments he has made to the media violate a standing local order prohibiting lawyers from talking about the merits of the case or its evidence outside court. They wrote that they were not yet asking the judge for relief but could do so in the future.

Chutkan on Friday indicated that she is weighing imposing a gag order in the case and asked that both sides file a submission about whether they believe one is advisable by Sept. 9.