This dissertation is an examination of the transition of Iranian residents of the Ottoman Empire into a visible, foreign Iranian community in the nineteenth and early twentieth centuries. The Ottoman-resident Iranians, who in earlier centuries had been treated as Muslim subjects or, if non-Muslim, as dhimmis, were legally classified as foreigners and Iranian nationals in the late nineteenth century and came to constitute a visible Iranian community. This dissertation discusses this transition as a process of conflict and negotiation among various actors: the Ottoman and Iranian States and the Ottoman-resident Iranians themselves. Through a discussion of this transition, this dissertation simultaneously presents a legal and social history of these Iranians living in the Ottoman Empire. In doing so, this dissertation aims to engage Iranians in contemporary discussions about Ottoman communities. In the first part, which consists of two chapters, this dissertation analyses the extent and ways in which Iranians living in the Ottoman Empire actively participated in and were influenced by the legal, intellectual and social changes of the Ottoman and Iranian States in the nineteenth and early twentieth centuries. This part suggests that Ottoman and Iranian modernisation and identity-defining efforts directly affected the Ottoman-resident Iranians constituting an Iranian community within the late Ottoman Empire. After the distinction of Muslim and non-Muslim subjects was replaced with the concepts of Ottoman nationals and foreigners, these Iranians demanded a change of their legal status. The change began with the Erzurum treaty (1823), but Iranians legally became classified as foreigners - a milestone in their transformation into a foreign Iranian community - in the context of Nasir al-Din Shah's visit to Istanbul in 1873. The Ottoman-resident Iranians were involved in discussions of the concepts of tabe'iyat (subjecthood), vatan (homeland) and mellat (nation) in Iranian legal and intellectual spheres, which made them feel an affinity for an 'imagined Iranian community.' The Iranian Tazkereh (1900) and Tabe'iyat (1894/1901) Codes redefined the boundaries of the Iranian tabe'iyat and included Ottoman-resident Iranians as Iranian nationals. In the second part, this dissertation discusses the consequences of the Iranians' being categorised as foreigners and Iranian nationals and feeling affinity to an 'imagined Iranian community' in the social sphere, as well. Their unique category of foreigner paved the way for conflicts between the Iranians and the Ottoman State on some issues: tax payment, their forcible conscription into the Ottoman army and the Ottoman State's intervention into their business. As they formed legal, intellectual and spiritual bonds with Iran, the Ottoman-resident Iranians asked for Iranian protection when they conflicted with the Ottoman State on those issues. By using the approaches of 'history from below', this part examines the extent as well as the ways that Iranians used the 'methods of resistance' to the Ottoman State and explores the ways in which they asked for Iranian protection. The second chapter of this part discusses the extent to, and ways in which becoming foreigners, being considered Iranian nationals, and feeling an affinity for an 'imagined Iranian community' led to a social transformation in which these Ottoman-resident Iranians actively participated. This included the process in which the Ottoman-resident Iranians established their communal institutions just as Europeans living within the Ottoman Empire and organised ceremonies where they manifested their Iranianness publicly. All these made Iranians visible within the Ottoman social sphere.