Former congressman Anthony Weiner, whose penchant for sexting strangers online ended his political career and led to an investigation that upended the presidential race, will appear in federal court Friday to plead guilty to charges in connection with his online communications with a 15-year-old girl in North Carolina, officials said.

A law enforcement official said Weiner has agreed to plead guilty to a charge of transferring obscene material to a minor.

The official spoke to The Associated Press on condition of anonymity because the criminal charges had yet to be filed publicly with the court.