I have learnt somewhere that in India the British made homosexuality illegal in 1861 through Article 377 of the Indian Penal Code, terming it as "an act against the order of the nature". Was this the first time homosexuality was outlawed in India? If not, who was the very first to do so in the Indo-Pak subcontinent? Was it the one of the Muslim rulers?
Was this the first time homosexuality was outlawed in India? If not, who was the very first to do so in the Indo-Pak subcontinent? Was it the one of the Muslim rulers?
Answer: Not the British, the Portuguese (Portuguese India). During the Goa Inquisition commencing in 1560, more than 300 years before 1861 (i.e. Section 377 of the Indian Penal Code). Not a Muslim ruler, but the Catholics - in particular Portuguese inquisitors, the first one being Aleixo Díaz Falcão.
The earliest case of a conviction for "sodomy" I could find where the convicted is known by name is from 1589: Antonio de Matos, born in Hormuz, was sentenced to the galleys (i.e. being a galley slave) for life.
Sources: Alisa Meyuhas Ginio (1999): The Inquisition and the New Christians: The Case of the Portuguese Inquisition of Goa in The Medieval History Journal Vol 2, Iss 1, Stephanie Hassell (2015) Inquisition Records from Goa as Sources for the Study of Slavery in the Eastern Domains of the Portuguese Empire in History in Africa, Vol 42, pp.397-418) (scholarly papers behind paywalls, sorry); alternatively the wikipedia articles on the Goa inquisition and in the LGBT history of India.
Let me detail the various aspects of this in the following order:
- What exactly is being outlawed (homosexual behavior, not homosexuality)
- Who would be expected to outlaw homosexual behavior
- Who was the first to outlaw homosexual behavior anywhere on the Indian subcontinent
- Who was the first to outlaw homosexual behavior in all of the Indian subcontinent
1. What exactly is being outlawed
Note that it does not make sense to outlaw sexual orientations in the same way that it does not make sense to outlaw introversion, optimism, or perfectionism. Those behavioral patterns are parts of the personality that people cannot possibly do anything about. They are quite possibly already fixed at birth and most certainly partly hereditary.
Those who outlaw homosexual behavior typically deny that homosexuality exists, for ridiculous examples, see here and here. They see homosexuals as sinners against some moral or behavioral code and outlaw the sin ("sodomy" etc.). That this leads to cultural animosity, harassment persecution of LGBT people as a group, and witch hunt like incidents, is a different question.
2. Who would be expected to outlaw homosexual behavior
This is typical for religious fanatics, especially those in the tradition of the Abrahamic religions, although the degree to which homophobia is seen as a central element of the religion varies quite a lot with time and across religions. Currently, homophobia and persecution of homosexuals is a major element of Wahhabi ideology and of Islamist fundamentalism (since the Wahhabis are sponsoring and funding it, to some degree together with Iran) which finds some appeal in conservative Muslim culture in general. This has been very different in pre-modern times; Muslim states tended to be much more tolerant and liberal. Christianity on the other hand has experienced the opposite development and is much more liberal today than it used to be in the late Middle ages and in early modern times (although certain right wing elements in many predominantly Christian countries would very much like to reverse this and return to Middle age zealotry).
3. Who was the first to outlaw homosexual behavior anywhere on the Indian subcontinent
The Portugese were the first Europeans to arrive in India in 1498 and seize territories there as colonies from 1505. They lost no time to implement the Portugese inquisition against what they saw as "sodomites" and a lot of others.
4. Who was the first to outlaw homosexual behavior in all of the Indian subcontinent
The British were the first and only Europeans that did conquer larger territories in the subcontinent. This did not occur before the 19th century, however, after they defeated the French. Note that the subcontinent was rarely a unified political structure until then, except for the periods of the Maurya empire the Mughal empire and possibly the Gupta empire (each at the time of their largest extent). Consequently, if the original question is referring to laws that would have been valid for all of the subcontinent, the answer is that there, was for almost all times in history, no one with the authority to create such a law.
While they only reorganized Indian criminal law after conquering the subcontinent, they would not have tolerated "sodomy" even before that in the areas under their control. Neither would the other European powers, though none of them would have been quite as brutal as the Portuguese inquisition.
Edit (Feb 2018): Since it was criticized that the answer might be missing the point, I tried to structure it better with a tl;dr section and sections detailing the various aspects. The contents and explanations are the same as in the first version of the answer.
Edit (Aug 2018): @J Asia: Thanks for helping improve this answer. I believe you were thinking about explicit evidence of persecution of lesbian sexual practices ("lesbian sodomy") which is discussed by the book you cite (Soyer, F., Ambiguous Gender in Early Modern Spain and Portugal (Brill, 2011), p.45.) and corresponds better to the date (1744) and names (Joao Cosme da Cunha) you give. However, the Goa inquisition commenced about 200 years earlier, in 1560 with inquisitor Aleixo Díaz Falcão by royal order of king João III following a request St. Francis Xavier made in 1546. Please see the linked wikipedia article on the Goa inquisition and the sources cited there. It was standard practice for the inquisition (especially in its Iberian tradition) to persecute homosexual behavior, male "sodomy" in particular. But there is no reason to believe that they were much more lenient with "female sodomy" where it came to their attention. In fact, as Ginio (1999) details, sodomy accusations were quite common in the Goa inquisition, including false accusations brough by bribed witnesses. Ginio's evidence includes a tretise written in 1687 by Charles Dellon who had been subject to such an accusation himself.