Milking system and a method for preventing detachment of a teat cup from a teat of an animal during a milking process. The milking system comprises a milk line (1b, 1c, 2) connected to the teat cup (1a), a vacuum system able to apply at least two different vacuum levels to the teat cup (1a) and a measuring device (4) configured to measure the air flow in the milk line (1b, 1c, 2) during the milking process. The milking system comprises a control unit (5) configured to receive information about measured air flow values and to determine if the teat cup (1a) is about to be detached from the teat by comparing the measured air flow values (qa) with an acceptable value (qa1, &Dgrq/&Dgrt), if the measured air flow values are not acceptable, to control the vacuum system such that it applies a higher vacuum level to the teat cup (1a) than the present vacuum level.