Soak the beans in a bowl of cold water overnight. Drain and transfer to a flameproof casserole. Cover with fresh cold water, bring to the boil and cook for 15 minutes. Drain and set aside. Discard any areas of excess fat from the lamb and cut the meat into 8 large chunky pieces. Season with salt and pepper and set aside.
Wipe out the casserole. Heat 3 tablespoons of the oil and fry the lamb in two batches, until browned on all sides, lifting out with a slotted spoon on to a plate. Add the tomatoes and sugar to the casserole and fry, turning in the oil, for 3 minutes. Slide out onto a plate and wipe out the pan. Add the remaining oil and onions and fry for 5 minutes. Tip in the beans, garlic, stock, rosemary and tomato paste. Bring to the boil, then reduce the heat, cover and cook for 45 minutes or until the beans are tender. The water should be almost absorbed; if not, uncover, increase the heat and reduce.
Stir in the capers and push the lamb down into the beans. Re-cover and cook gently for 8–10 minutes so the lamb is still pink in the centre. (For well-cooked, allow an extra 15 minutes.) Stir in the tomatoes and heat. Season to taste and leave to stand for 15 minutes.