Libyan cadets sent home early after Cambridge sex assaults
It said it would also review whether further groups of Libyan recruits should be trained in the UK.
The decision came after South Cambridgeshire MP Andrew Lansley wrote to the MoD calling for training to end.
The consequences of allowing soldiers on unescorted trips had been "unacceptable", he said.
About 300 recruits arrived at the base in June as part of a government agreement to train up to 2,000 cadets to ensure Libya's security.
At the time the MoD said the recruits would only be allowed on escorted trips.
However, it has emerged these rules were later relaxed. Last week they were reinstated, the MoD confirmed.'Repatriate the trainees'
Two Libyan recruits admitted carrying out a series of assaults on women in Cambridge's Market Square area on 26 October and are awaiting sentencing.
Conservative Mr Lansley said he initially supported the UK's commitment to train the recruits.
"It is with regret that I must now say that it has not worked as we had hoped," he said.
"It is clear that the stipulation that there was to be no unauthorised exit from the base has not been adhered to and the consequences have been unacceptable.
"As I have today expressed to MoD, I now see no alternative but to terminate the contract and repatriate the trainees currently on the base.
"As this stands, no further groups of trainees could be brought here from Libya."
Mr Lansley's office confirmed he had written to Armed Forces Minister Mark Francois on Monday morning.
In a statement, the MoD said: "Training was initially expected to last until the end of November but we have agreed with the Libyan government that it is best for all involved to bring forward the training completion date. The recruits will be returning to Libya in the coming days.
"And as part of our ongoing support for the Libyan government, we will review how best to train Libyan security forces - including whether training further tranches of recruits in the UK is the best way forward."