Pakistan received its first submarine, the Ghazi, from the United States in 1964, and then added to its fleet with the delivery of three Daphne-class boats from France. These four vessels represented the nucleus of Pakistan's submarine force during the 1971 war with India.  After losing the Ghazi during the war, Pakistan replaced it with another Daphne-class vessel that it purchased second-hand from Portugal in 1975. As a result of the demonstrated utility of its submarine fleet, the country further augmented its flotilla with the purchase of two Agosta-70B class boats from France. These submarines were initially intended for South Africa, but, due to the arms embargo mandated by the United Nations in 1977, they were instead sold to Pakistan in 1978. 
In 1994, Pakistan negotiated the acquisition of three Agosta-90B boats from France's Directions des Constructions Navales Services (DCNS). While the first of the class was built in France, the second boat was assembled in Karachi using prefabricated segments from DCNS. A third vessel - the S 139 Hamza, which was commissioned on 26 September 2008 - was constructed entirely in Karachi, with the exception of its MESMA air-independent propulsion (AIP) system. 
DCNS's competitors for the contract included Sweden's Kockums with its T 96 design; Vickers Shipbuilding and Engineering Ltd. (VSEL) with decommissioned Upholder-class boats; Rotterdamsche Droogdok Maatschappij Submarines B.V. (RDM) with its Moray design; and the China State Shipbuilding Company, which tendered a modified Romeo design.  The deal represented DCNS's first export of its MESMA AIP technology, which was installed in the last of the three boats during construction. The first two vessels will be retrofitted with MESMA at a later date. 
In the mid-2000s, Pakistan began looking at options to expand its submarine fleet with the procurement of additional conventional submarines. Initially the top contenders were France's DCNS, which offered its Marlin-class vessels, and Germany's Howaldtswerke-Deutsche Werft (HDW), with three Type 214 submarines.  DCNS later attempted to increase the value of its bid by offering to supply Scorpene-class diesel-electric boats as well.  Although both designs featured AIP, Islamabad chose the more advanced Type 214, and in 2008 HDW's chief executive officer signaled that the contract was "finalized up to 95 per cent."  However, the final agreement never materialized because Pakistan felt the conditions of the German export loan were too stringent, and German politicians feared contributing to an arms race in South Asia.  This failure led Pakistan to reconsider DCNS as a potential supplier, but France's price was also too high.  Instead, Pakistan turned to its long-time defense partner China, which offered AIP-equipped Yuan-class submarines to Pakistan with very low interest rates.  In May 2011, the Pakistani cabinet approved the start of negotiations with China for six submarines, although the details have yet to be finalized. 
Pakistan's Karachi Ship and Engineering Works (KSEW) received extensive technology transfer from France's DCNS for the development of the Khalid-class (Agosta 90B) submarine program. Pakistan modernized the Karachi Naval Dockyard in order to facilitate the assembly and construction of the S 139 Hamza, its first indigenously built submarine. 
Realizing the potential revenue from submarine sales and the need for such profits to maintain its submarine construction capability, Pakistan's deal with France also included an export license agreement for the Agosta 90B submarines. As a result, Pakistan gained the potential to sell its vessels in certain regional markets, including the Middle East and Southeast Asia, with France's approval.  But in spite of this capability there have been no reports to date of any pending submarine exports. It was rumored that Saudi Arabia and Malaysia had shown some interest, but both countries eventually chose to procure vessels directly from DCNS instead. 
Pakistan’s prospects for winning submarine contracts appear uncertain as the only model that it is currently capable of producing is an aging, albeit modernized, French design. The Pakistan Navy envisions substantial technology transfer in the potential submarine order from China, with much of the work being completed domestically at KSEW. 
 "The Fleet: Submarines," Pakistan Navy, https://paknavy.gov.pk.
 Jacques Isnard, "A Navy to a large extent under France's wing," Le Monde, www.lemonde.fr, 9 May 2002; "S 135 Hashmat class," Periscope USNI Military Database, www.periscope1.com.
 "Pakistan navy inducts new submarine," Associated Press of Pakistan, 27 September 2008, in Lexis-Nexis Academic Universe, www.lexis-nexis.com.
 Richard Scott, "Agosta 90B surfaces for the Pakistani Navy," Jane's Navy International, 1 May 1999, Vol. 104, No. 4; "Mogelijk Nederlandseonderzeeersnaar Indonesie," Algemeen Nederlands Persbureau, 9 June 1994; in Lexis-Nexis Academic Universe, www.lexis-nexis.com.
 Richard Scott, "Agosta 90B surfaces for the Pakistani Navy," Jane's Navy International, 1 May 1999, Vol. 104, No. 4.
 "Pakistan Navy Said to Get Three German Submarines," BBC Monitoring South Asia, 26 November 2008, www.lexisnexis.com
 "DCNS Promotes Scorpene for Pakistan Buy," Jane's Defence Weekly, 13 June 2007, www.lexisnexis.com.
 "Pak to Buy Three Submarines from Germany," Asian News International, 3 December 2008, www.lexisnexis.com.
 "Germany Negotiating Sale of Submarines with Pakistan," BBC Monitoring Europe – Political, 13 July 2009, www.lexisnexis.com; "France, Germany Vie to Sell Submarines to Pakistan," South Asian Media Network, 23 July 2009, www.lexisnexis.com.
 "France, Germany Vie to Sell Submarines to Pakistan," South Asian Media Network, 23 July 2009, www.lexisnexis.com; "How Paris Lost the Pakistani Market; Arms Sales," Intelligence Online, 17 March 2011, www.lexisnexis.com.
 "How Paris lost the Pakistani Market; Arms Sales," Intelligence Online, 17 March 2011, www.lexisnexis.com.
 Farhan Bokhari, "Pakistan to Start Formal Talks with China to Buy Subs," Janes' Defence Weekly, 23 March 2011, www.lexisnexis.com; "Pakistan Cabinet Approves Holding of Talks to Procure Six Chinese Submarines," BBC Monitoring South Asia – Political, 14 March 2011, www.lexisnexis.com.
 "Khalid Class (Fr Agosta 90B)," GlobalSecurity.org; "Pakistan commissions AIP-equipped Agosta," Jane's Defence Weekly, 8 October 2008, in Lexis-Nexis Academic Universe, www.lexis-nexis.com.
 Kaleem Omar, "Arms export drive begins to bear fruit," The News, 12 February 2001, p. 13; Jacques Isnard, "A Navy to a large extent under France's wing," Le Monde, 9 May 2002, www.lemonde.fr; NasirJaffry, "2nd Agosta to be ready for trial soon," The Statesman, 16 February 2002, www.thestatesman.net.
 "Saudi Arabia, Malaysia Interested in Buying Aircraft, Submarines from Pakistan," Jang, 18 November 2000, www.jang.com.pk; "The real Saudi-Pakistani pact," Intelligence Online, www.intelligenceonline.com, 31 October 2003; "Pakistan commissions AIP-equipped Agosta," Jane's Defence Weekly, 8 October 2008, in Lexis-Nexis Academic Universe, https://web.lexis-nexis.com; Michael Dumiak, "Lurking in the Littorals: Diesel-electric subs gain range and lethality," Defense Technology International, May 2007, pp. 24-27.
 "Submarines, Pakistan," Jane's Underwater Warfare Systems, 29 June 2011.