Daniel Khalife was told that his Iranian heritage would prevent him from working in army intelligence, a court has heard