WICHITA — When Brian Newby took the helm of a federal election agency, he left behind an unfolding scandal in Kansas where he was having an affair with a woman he promoted in his previous job and used her to skirt oversight of their lavish expenses, prompting a local prosecutor to investigate, according to emails obtained by The Associated Press.

The affair and resulting fallout was revealed in hundreds of emails ordered released after AP sued Johnson County, the Kansas City suburb where Newby was the top election official before leaving to become executive director of the U.S. Election Assistance Commission.

The emails — coupled with hundreds more obtained from the Kansas secretary of state’s office through a separate open records request — portray a rogue election official who berated employees and deliberately bypassed supervision. They also document a toxic workplace created by his affair with then Assistant Election Commissioner Jessica White, an apparent violation of county policy on intimate relationships with subordinates.

In a June 2015 exchange from his work email to her personal address, the then-married Newby told White: "You, my little lover, are so wonderful." In graphic language, Newby also describes a sex act he wishes he was doing with her, "scheming and dreaming with you into the night."

Newby and White did not respond to numerous phone and email messages seeking comment.

Newby’s penchant for ignoring supervision continued when he took the top federal job in November 2015 at an agency whose mission is to make voting easier. He enraged voting rights advocates when, without public notice or approval from agency commissioners, he tightened voting registration rules in three states. A federal appeals court last month temporarily blocked Newby from changing a federal voter registration form to require residents of Kansas, Alabama and Georgia to show proof of U.S. citizenship, saying it is "difficult to imagine a more clear violation" of federal administrative law.

A scathing county audit of the Kansas election office found Newby intentionally circumvented oversight by charging expenses to White’s government credit card, allowing him to review and approve his own spending. Auditors also said Newby and White made purchases without sufficient business justification and supporting documentation.

Some emails offer a glimpse into an investigation opened by the district attorney’s office. Newby’s Kansas office had drawers full of phones, tablets and other equipment not listed in inventory. Tom Gottschalk, financial crimes investigator for the district attorney, asked in one email for access to the locked office to examine them. The investigator also wanted a list of everything the elections office had discarded as surplus in the last five years.

Kristi Bergeron, spokeswoman for the district attorney’s office, said she did not know the status of that investigation.

In an email touching on his management style, Newby prodded an employee to speed up work on a project by noting he had "terrorized" two other employees. He copied one of those employees on that email, telling the person he was doing so in the event they wanted to commiserate or "share the therapy sessions I undoubtedly caused."

Newby promoted White to assistant election commissioner in January 2015, emails show.

White at times publicly belittled other employees, often leaving them in tears, and some colleagues feared crossing her because Newby always backed her, said a former employee who spoke to the AP on condition of anonymity because of career concerns. One email sent to the secretary of state’s office refers to numerous grievances filed against her with the county’s human resources department.

Newby would spend hours alone with her each work day in his closed office or in the warehouse where there is a workout area. They were frequently gone on business trips together, the former employee said.

The evening before the local election in April 2015, a line of poll supervisors waited half an hour for a list from White because no one dared knock on his office door and interrupt the couple, the former employee said.

Johnson County officials met with Kansas Secretary of State Kris Kobach and his staff on April 22, 2015, about "several concerns" dealing with the election office, according to an email from county spokeswoman Sharon Watson. The email does not specify the concerns.

Kobach said through his spokeswoman that he was not aware of Newby’s affair at the time he reappointed him to the Kansas job and recommended him for the federal position.

"Mr. Newby was, and remains, one of the most highly regarded election administrators in the United States. He has received national awards for his excellent and innovative work," Kobach told AP in a statement. "It was for that reason that I re-appointed him to the position of Johnson County Election Commissioner in 2014. And it was for that reason that I later recommended him favorably to the EAC when I was asked my opinion."

After auditors presented their findings to county officials in March, Johnson County Commissioner Steve Klika publicly apologized to Newby’s replacement for having "to deal with this."

White resigned from the Johnson County election office in January, and is now a Washington, D.C.-area voter services manager at the Montgomery County Board of Elections in Maryland.

Newby filed for divorce from Lori Newby in March 2015 and a decree last month ended their 30-year marriage.

Elections office staff "collectively gave a sigh of relief" when they learned Newby was leaving, election worker Jenifer Lefort wrote in an email to Kobach. She said his departure would help "restore morale and well-being."

Others were less restrained. Janette Scobey, the office technology manager, wrote to Kobach, "I just wanted to say thank goodness he is out of here."