Heat the olive oil in a wide shallow pan over a medium heat. Add the onions and garlic and sauté for 15 minutes, stirring every now and then, until soft and sweet and very lightly golden-brown.
Add the tomatoes, water, bay leaves, salt and sugar, bring to the boil, lower the heat and leave to simmer very gently, uncovered, stirring now and then, for 45 minutes to one hour until it has almost reduced to a purée. Leave to cool slightly then remove the bay leaves, tip into a food processor and blend until smooth.
Leave to cool, cover and refrigerate or freeze until needed.