A judge has heavily criticised a Welsh council, branding its errors 'indefensible'