Why did Spain and France decide to give up the Louisiana Territory?

A. They feared an attack from the U.S.
B. The territory had little economic value.
C. They gave up the territory to end a war.
D. The land could not be farmed.