Discarding the spoiled or mouldy part of food makes it safe

Not necessarily. Food spoilage can arise from contamination of food with organisms that may or may not be harmful to people. Because it is not possible to reliably distinguish between harmless or harmful organisms by visual examination, spoiled food should always be discarded. Some organisms produce substances that are extremely poisonous and only a minute amount can cause illness. These substances may diffuse into the food so that just removing the visible signs of spoilage can still leave the toxins in the food.