It appears Fabian Castillo will be staying in Turkey, at least until the end of the year.

SI.com understands that FC Dallas and Trabzonspor have reached an agreement to conclude what has been a strange and awkward transfer saga. Castillo will remain with the Süper Lig team for the remainder of 2016 in exchange for a transfer free of approximately $3 million. In January, Trabzonspor will be on the hook for additional funds, otherwise Castillo’s rights will revert to Dallas.

It's unclear how much money FCD will be owed in January. The original fee for Castillo was $4 million, meaning the new arrangement could simply mean more up front, or it may involve an overall increase.

FC Dallas will keep two-thirds of the transfer fee. The rest goes to MLS.

Fabian Castillo's strange transfer saga continues after Trabzonspor deal dies

Castillo’s decision last month to leave for Trabzon without permission, followed by the signing of a new contract before the transfer was finalized, put Dallas in an odd position.

The player clearly wanted to move, but FCD and MLS were concerned about whether Trabzonspor was willing and able to pay the fee. The two sides came to a compromise early last week—FCD would receive $2 million now and $2 million in January. But the money never arrived. While Castillo's agent claimed to be in New York City meeting with league officials, Dallas was put into the uncomfortable position of ordering Castillo, who was still in Turkey, back to Toyota Stadium for practice.

Instead, a minimum of $3 million is headed from Turkey to Texas, with more due over the winter.

FC Dallas is 1-0-1 since Castillo left the team the day it traveled to Denver for a game against the Colorado Rapids. FCD hosts Nicaragua’s Real Estelí on Thursday evening in their CONCACAF Champions League opener.