"Friends can be changed but not neighbours. Therefore, there is need to remain cautious," he said at a function of the Southern Command on the Army Day here.
Akhilesh, who was the chief guest, promised all help to army jawans and their families.
On the occasion, medals were presented to 31 jawans.
Lt Gen A K Singh, who addressed the jawans, said the army was capable of giving a befitting reply to enemies of the country.
On the brutal killing of the two Indian soldiers by Pakistani troops, he said a reply would be given with interest at an appropriate time.