Mujahid narrates from Ibn Abbas (may Allah be pleased with them both) that Allah Almighty, through the words of your Prophet (peace and blessings be upon him), made the prayer obligatory as four rak'ahs for the resident, two rak'ahs in travel, and one rak'ah in a state of fear. The wording of both narrations is the same.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5383