BRUSSELS — The European Union and Afghanistan announced a deal on Wednesday that would send tens of thousands of Afghan migrants who had reached Europe back home to an increasingly hazardous war zone.

The agreement is the most specific effort yet by Europe to divert or reverse a wave of hundreds of thousands of migrants from war-torn countries including Afghanistan and Syria. But unlike a major agreement with Turkey this year to have that country host more Syrian refugees, the new deal as worded would forcibly send Afghans whose asylum applications were rejected directly back to an intensifying war that has taken a severe toll on civilian life — seemingly at odds with international conventions on refugees.

“The E.U. and the government of Afghanistan intend to cooperate closely in order to organize the dignified, safe and orderly return of Afghan nationals to Afghanistan who do not fulfill the conditions to stay in the E.U.,” the agreement read.

The repatriation deal was announced alongside an international conference in which governments pledged $3.75 billion in annual development aid to Afghanistan over the next four years. But few of the keynote speakers even hinted at the worsening security in the country in recent weeks, and none publicly discussed the repatriation deal, which was reportedly signed on Sunday.