That sounds like a weak/high resistance connection someplace, or a marginal/weak battery.
I go with the connection first because it could explain why the engine stopped for no reason.
So, jump the starter solenoid. If it doesn't spin, then check all the connections at the battery and solenoid first, then load test the battery.
I would do that before taking bigger things apart.