The men , who spent between six months and 15 years in Indian jails for straying into Indian territory , were handed over to Pakistani authorities at the Wagah border crossing Thursday .