Brexit court defeat for UK government