under the panama canal treaties signed in 1977 , the united states promised a gradual pullout from panama , slowly relinquishing pieces of the canal zone -- and eventually the canal itself -- by dec. 31 , 1999 .