The governments of Spain and Brazil issued a joint statement on Friday calling their detention illegal