The agreement ends a long-running dispute.