RALEIGH, N.C. (AP) — A North Carolina state lawmaker is resigning his position a day after pleading guilty to cyberstalking his estranged wife.

Second-term Republican Rep. Cody Henson on Wednesday said he was resigning from his position representing Transylvania, Polk and part of Henderson County on Friday. He said he wanted to spend more time at home with his two children.

Henson pleaded guilty on Tuesday to the misdemeanor cyberstalking charge that will be dismissed if he completes 18 months of probation.

A judge earlier this year issued a protective order against Henson after determining texts his wife received amounted to "mental harassment." Henson said Tuesday he was "overly zealous" and used the wrong methods to try keeping his family together.