Former NASCAR driver John Wes Townley attacked his ex-wife and another man with a hatchet just before he was shot to death ... this according to police.
It's all spelled out in new documents, obtained by TMZ Sports, which show cops say Townley showed up to his ex's house in Athens, Ga. on Oct. 2 and allegedly snapped.
In the docs, cops say Townley got to the home and attacked his ex, Laura Townley, and another man, Zachary Anderson, with a hatchet.
Police in the documents say, though, Anderson shot John in the altercation .