Surely, God had the greatest role in determining the outcome.
After the War, someone (tactlessly) asked Longstreet who he thought was responsible for the defeat at Gettysburg: Lee? Stuart? Pickett? Himself? Longstreet replied, “I always thought the Yankees had something to do with it.”