Deductions & credits

The Capital gain is in U.S and not in India. Should I pay taxes to India or U.S ? And then I can take credit. But which country should I pay first?