The UK and Nigeria have signed an agreement to allow the transfer of prisoners between the two countries.
It means citizens of one who commit crimes in the other will serve sentences in their homeland.
The UK government said it meant inmates could be "properly prepared for release into the community in which they will live following their release".
Both countries already have prisoner-transfer treaties in place with several other states.
The UK-Nigeria agreement was one of the objectives outlined by UK Prime Minister David Cameron and Nigerian President Goodluck Jonathan following a meeting in 2011.
It is expected the first prisoner transfers will take place before the end of this year.
UK Justice Minister Jeremy Wright said: "Removing foreign national offenders is a key priority for the British government and the prisoner transfer agreement I signed this morning with the Nigerian attorney-general plays a significant role in supporting this.
"Both the United Kingdom and Nigeria have prisoner transfer arrangements with other countries and it is right that our two countries, which have such strong ties and shared interests, should develop our own arrangements.
"I strongly believe that this agreement will have significant benefits for both our countries."