SAMARKHEL, Afghanistan — There is one country in the world that is now taking in more Afghan migrants than all the countries in Europe and South Asia put together this year.

That would be Afghanistan itself.

By the end of the year, aid officials here expect some 1.5 million migrants to return to Afghanistan — many of them forcibly, and including some officially registered as refugees.

Some will come from Europe, which has recently signed a deal with Afghanistan to return tens of thousands of migrants who were not granted asylum. A far larger number are being forced back by Iran and, particularly, Pakistan, where the United Nations says there are 1.3 million registered Afghan refugees and an additional 700,000 undocumented Afghans.

Many Afghans report that concerted harassment and discrimination by the Pakistani authorities have become too much to bear. And Pakistan has flatly given Afghans a Nov. 15 deadline to obtain legal documents like passports and visas — a near impossibility for most — or they will face arrest and deportation, which could lead to even greater numbers leaving Pakistan in the coming weeks.