John F. Kennedy was elected president in 1960 in one of the closest races in American history. As president, Kennedy established the Peace Corps to provide humanitarian aid around the world. He committed the US to landing on the moon to win the space race against the Soviet Union. However, the Bay of Pigs invasion of Cuba was a failure that made the US look weak. Kennedy faced further challenges with the Berlin Wall and Cuban Missile Crisis, before his presidency was tragically cut short by his assassination in 1963.