Negotiation
Two hostile nations both claim a piece of territory. They may go to war over it. Or, they may negotiate some agreement or peace treaty. The agreement would be written down, and both governments would agree to keep the agreement.