Democrat Nathan Johnson has been elected Texas attorney general, defeating Republican Mayes Middleton, according to The Associated Press race call.

The election determines who will succeed Ken Paxton, who chose to run for U.S. Senate after more than a decade as attorney general.

Middleton, a Republican state senator, won his party's nomination after defeating U.S. Rep. Chip Roy in the May primary runoff.