Shortly after achieving independence from Britain in the early 1960s , Tanganyika and Zanzibar merged to form the nation of Tanzania in 1964 .