They were said to be part of a "complex network" charging up to pounds 2,500 a time for special passport stamps allowing foreigners leave to remain in Britain indefinitely.
"There are individuals who have made enormous sums of money and are very wealthy as a result of this ongoing practice," Dominic D'Souza, for the defence, said.
He told Inner London Crown Court there was evidence that his client, Samuel Essuah, a former Home Office official, had been threatened with a gun and told to keep quiet.
The court heard that Essuah, who received a 12-month sentence after admitting his role in the racket, was no longer working for the Civil Service when he became involved. But his knowledge of Home Office immigration procedures would have been useful.
Mark Kemsey, for the prosecution, said Essuah, of Kilburn, north-west London, was suspended from the asylum screening unit for a separate matter in 1992, two years before he turned to crime.
Well-known in the Ghanaian community, he claimed he was still a civil servant and could arrange indefinite "leave to stay" stamps to be put into the passports of his fellow countrymen.
Four people paid between pounds 2,000 and pounds 2,500 for the stamp, not realising it had been issued illegally.
The swindle was exposed when Ghana produced a smaller passport and told all its nationals in Britain to change their old ones. When the four that Essuah had helped handed theirs over, Home Office records revealed they had not been given permission to remain in Britain.
"The Crown has accepted in this case that there are others involved," said Mr Kemsey.
"The defendant was the courier, he was the go-between ... it appears the money has been handed on to others except for pounds 100 to pounds 200 per transaction that went to him."
Mr D'Souza said Essuah, who admitted four counts of "making arrangements for securing or facilitating leave to remain", had intended to help people only on a limited basis. "But thereafter it spiralled out of control," he said.
His client was later to speak of being "threatened with a gun and told to keep quiet".
"He was so concerned, he gave his name and telephone number to those witnesses and indicated that if anything should happen to him they should contact the police."
The barrister continued: "There are serious implications as far as the Home Office is concerned in that there appears to be a complex network of corruption in the Home Office itself involving the fraudulent granting of leave to remain stamps for profit."
Individuals of higher rank in the Home Office were "pulling the purse strings".
"Mr Essuah had very limited involvement in what appears to be a very much larger and very much more serious conspiracy so far as other individuals are concerned."
Judge Jeremy Fordham said the racket "struck at the heart" of immigration policy.Reuse content