A controversial offshore petroleum licence has been cancelled by the government for public interest reasons, after being fought in courts for a surprising reason.