Motor decouple

Hello everyone. I’m new to electronics and a have a question that after many hours of searching I haven’t found a satisfactory answer to: in the schematic I have attached, what is the role that the diode plays?
Without the diode and the capacitor my Arduino resets when the motor starts. I get how the decouple capacitor helps but not what the diode contributes. I use a 1N4001 in my case and without it (only with the capacitor) the resets continue. Thanks in advance.

OP’s image:

Assume the top of the capacitor connects to the Vin pin on the Arduino.

The diode prevents the capacitor from back feeding to the 12v power supply.

If the driver does not reverse the motor’s direction, there should be snubbing added to the motor (assuming there is none in the driver).

The diode prevents the motor driver from discharging the capacitor.

The diode prevents the motor driver from discharging the capacitor.

This would be obvious to anyone but a newbie so think of the motor as a hungry bear
looking for honey (energy) which the cap stores (being an energy storage device) and
the diode is like a fence that keeps the bear from eating the honey in the capacitor.

Alternately, for a more scientific explanation you could (or rather could have) just google diode theory.

Now that's what I'm talking about. The bear
got into the cap...

Stated differently:

The diode allows the Arduino to run if the 12V to the motor is not there.

Also,
When a motor starts up, the current required to accelerate the armature is very large. If this large current draw causes the V12 to the motor to drop down momentarily, the diode will stop the motor from drawing current from the 1000µF cap (and your arduino).

note for underlined text:

it is assumed the large motor current draw will drag down the voltage on the 1000µF to a point the arduino will reset due to momentarily low input voltage.