 In 1973, Shahi became Foreign Secretary and served in that position till the fall of Prime Minister Zulfikar Ali Bhutto in 1977.Shahi was appointed Advisor on foreign affairs/foreign minister in 1977 by General Muhammad Zia-ul-Haq and resigned from the position of foreign minister in 1982, after developing serious differences with General Zia.Shahi led various delegations of Pakistan to UN General Assembly, conferences of Non-Aligned Movement and Organization of Islamic Conference.