Robert Williams, Jr., spent the night in jail -- just hours after he was elected mayor of a small town in eastern North Carolina.

Police pulled Williams over Tuesday after they received a tip and saw his vehicle run off the right side of the road, WNCN-TV reported.

He was arrested on a DWI charge as well as multiple gun charges, including possession of a firearm after consuming alcohol and possession of a firearm on government property. Additionally, Williams was charged with resisting arrest and failing to stop for blue lights and sirens, WNCN reported.

Williams’ arrest occurred about an hour after polls had closed, and he was elected mayor of Sharpsburg, according to WNCN.

Williams led Sharpsburg from 2011 to 2013 after he was appointed mayor. He lost in 2013 to Randy Weaver, who has served as the town’s mayor ever since, the Rocky Mount Telegram reported.

But in Tuesday’s election, which the state reportedly called after it found a discrepancy in the 2017 race, Williams beat Weaver with 50.9 percent of the vote, according to the newspaper.

Williams is slated to appear in court on June 5, according to WRAL-TV.