The term Kutim refers to the nations (not all of whom were truly Kutim, as there were people from other nations, as well) that were exiled to the Land of Israel by the kings of Assyria who were interested in populating the land after they had removed the Israelite people from it. According to Sefer (see II, chapter 17), these nations converted to Judaism because of their fear of lions that had begun attacking them (from which derives the term gerei arayot – “lion converts”), but they continued worshiping their gods at the same time.
Upon the return of the Jews to Israel at the beginning of the Second Temple period, the Samaritans, decedents of the Kutim, were active in trying to keep the returnees from rebuilding the Temple and the walls of the city of Jerusalem. Even so, there were families – including members of the kohanim – who intermarried with the Samaritans.
During the following years there were continued tensions between the two communities, and Yohanan Hyrcanus led his troops into battle against the Samaritans and destroyed the temple that they had built on Har Gerizim. Nevertheless, there were also periods of cooperation, such as the period of the Bar Kokheva rebellion. As is clear in our Gemara, the attitude of the Sages towards them differed, although after a period of time a final conclusion was reached and they were ruled to be treated as non-Jews, due to their continued involvement with different types of idol worship.
It is important to note that the Gemara in Yevamot concludes that while a beit din should not accept potential converts whose reason for converting is anything other than a sincere desire to join the Jewish People, nevertheless, if such a person does undergo a full conversion process they are considered Jewish according to halakha. It is possible that the Kutim did not fall into that category because they continued with their idolatrous practices even at the moment of their conversion. Nevertheless, today, the Samaritans living in Israel are no longer idol worshipers, and there has been some level of acceptance of them into the larger Jewish community.