26 minor girls were rescued by the GRP and RPF from the Muzaffarpur-Bandra Awadh Express after a tweet from a passenger alerted them to the situation.
On July 5, a passenger on board the train tweeted that he was travelling in the S5 coach of the train and noticed the girls crying and looking uncomfortable.
Reacting to the tweet, officials in Varanasi as well as Lucknow swung into action and within half an hour of the alert on social media site started investigating the matter, a railway spokesperson said.
The GRP at Gorakhpur coordinated with Childline along with the anti-trafficking unit of the police.
Two RPF jawans in plainclothes boarded the train at Kaptanganj and escorted them to Gorakhpur.
"26 girls were found with two men, aged 22 and 55 years. All of them are from West Champaran in Bihar. The girls were being taken from Narkatikyaganj to Idgah. When questioned the girls were unable to answer anything convincingly, so they have been handed over to the child welfare committee.
The girls are believed to be aged between 10 and 14 years.
"Their parents have been informed and the men have been taken into custody," a statement from RPF said.