India was in touch with Togo authorities to secure on compassionate ground the release of the sailor whose family wanted him to conduct the last rites of his 11-month-old son.
Indian officials from Accra had met the sailor recently and had been pursuing the case of his release with the authorities there.
James has been released, the sources said, adding he is expected to return home by Friday.
He was under arrest in the west African country since July on the charge of aiding pirates who had attacked and looted his Marshall Islands-flagged MT Ocean Centurion on July 16.
The sailor's 31-year-old wife Aditi and others in the family wanted James to conduct the last rites of his son whose body is lying in a hospital morgue since the toddler's death from septicaemia on December 2.
It was reported that the infant, Vivaan, underwent an operation for intestinal gangrene but doctors could not save him as the infection had spread to his bloodstream.
Review: New Honda City Diesel is India's most fuel-efficient car
India's biggest wealth destroyers, Reliance tops
Year-end Special: Who is the most SHAMELESS of them all?
IMAGES: Inside Bangalore's swanky airport terminal
After losing elections, PM says inflation worries 'legitimate'