WASHINGTON — Federal prosecutors have admitted that they wrongly accused Maria Butina, a Russian citizen now in custody on charges of illegally acting as a foreign agent, of offering to trade sex for a job as part of a covert effort by Russian government officials to infiltrate Republican circles in the United States.

In a court filing late Friday, prosecutors in the United States attorney’s office in Washington acknowledged that they had been “mistaken” in interpreting what were apparently joking text messages between Ms. Butina and a friend who had helped her renew her car insurance.

Ms. Butina was charged this summer with conspiracy and illegally acting as an agent of the Russian government in what prosecutors have claimed was a secret campaign to try to influence high-level Republican politicians, including Donald J. Trump, both as a candidate and after his election. Denied bail, she is now in custody in the detention center in Alexandria, Va.

Defense lawyers for Ms. Butina are arguing that the prosecutors’ error is emblematic of a flawed federal case that has wrongly landed their client in pretrial custody. A federal judge is scheduled to review Ms. Butina’s request that she be released from jail, as well as whether to impose a gag order, on Monday.