Why was the Panama Canal returned to Panama?

It was originally promised to the Panamanians before it was built. The U.S. would control it for a certain amount of time, and it would then be given to Panama.