Too much detergent was used.
Follow the instructions on dosage given on the detergent packaging.
Take the water hardness into account when calculating the dispensing amount.
Use less detergent if the laundry is not particularly soiled or when washing fewer items.