Avtalet nåddes i Bryssel efter mer än 20 års förhandlingar.