Frederick II recaptured Jerusalem through negotiations and not through wars. He promised the local Muslim rulers to help them against their enemies, and they agreed to give Jerusalem back to the Holy Roman Empire.