The United States has sent a shipment of weapons and ammunition to the government of Somalia, according to a U.S. official who said the move signals the Obama administration’s desire to thwart a takeover of the Horn of Africa nation by Islamist rebels with alleged ties to al-Qaeda.