John F. Kennedy was elected president in 1960, becoming the youngest man and first Catholic elected to the office. His youth and optimism captivated many Americans. As president, he established the Peace Corps to provide humanitarian aid abroad. He committed the U.S. to landing on the moon to win the space race against the Soviet Union. However, the failed Bay of Pigs invasion and Cuban Missile Crisis were foreign policy setbacks for his administration. Kennedy was assassinated in 1963 while visiting Dallas, Texas.