Emission-line gas associated with the radio lobes of the high-luminosity radio source 3C 171