European Union and Mediterranean officials at a summit in Barcelona , Spain , have reached a last-minute agreement on a code of conduct in the war against terrorism .