Milking system for milking dairy animals, and comprising: - at least one milking device for extracting milk from a dairy animal, and provided with a milk line for transporting milk from the milking device; and - a cleaning device for cleaning at least the milk line with a cleaning liquid; and furthermore provided with - a first outlet for discharging the extracted milk to a milk tank ; - a second outlet for discharging the cleaning liquid, - a valve mechanism for controllably connecting the milk line to one of the first outlet and the second outlet; and - a control unit for controlling the valve mechanism; wherein the valve mechanism comprises: - a first valve with a first valve housing and a first valve body , - a second valve with a second valve housing and a second valve body , characterized in that the valve mechanism further comprises: - a displacement device for displacing the first or the second valve housing with respect to the second or the first valve housing, respectively, between - a cleaning position, in which there is a first fluid connection between the milk line and the second outlet for discharging the cleaning liquid, wherein the first valve housing and the second valve housing are at a distance from each other, wherein the distance is other than zero, thereby forming a first space between the first and the second valve housing, and - a milking position, in which there is a second fluid connection between the milk line and the first outlet for discharging the extracted milk to the milk tank, and wherein the first valve housing and the second valve housing are adjacent. - at least one milking device for extracting milk from a dairy animal, and provided with a milk line for transporting milk from the milking device; and - a cleaning device for cleaning at least the milk line with a cleaning liquid; and furthermore provided with - a first outlet for discharging the extracted milk to a milk tank ; - a second outlet for discharging the cleaning liquid, - a valve mechanism for controllably connecting the milk line to one of the first outlet and the second outlet; and - a control unit for controlling the valve mechanism; - a first valve with a first valve housing and a first valve body , - a second valve with a second valve housing and a second valve body , characterized in that the valve mechanism further comprises: - a displacement device for displacing the first or the second valve housing with respect to the second or the first valve housing, respectively, between - a cleaning position, in which there is a first fluid connection between the milk line and the second outlet for discharging the cleaning liquid, wherein the first valve housing and the second valve housing are at a distance from each other, wherein the distance is other than zero, thereby forming a first space between the first and the second valve housing, - a displacement device for displacing the first or the second valve housing with respect to the second or the first valve housing, respectively, between - a cleaning position, in which there is a first fluid connection between the milk line and the second outlet for discharging the cleaning liquid, wherein the first valve housing and the second valve housing are at a distance from each other, wherein the distance is other than zero, thereby forming a first space between the first and the second valve housing, - a milking position, in which there is a second fluid connection between the milk line and the first outlet for discharging the extracted milk to the milk tank, and wherein <EOS>