Recent research has shown that virtual agents expressing empathic emotions toward users have the potentiality to enhance human-machine interaction. To identify under which circumstances a virtual agent should express empathic emotions, we have analyzed real human-machine dialog situations that have led users to express emotion. The results of this empirical study have been combined with theoretical descriptions of emotions to construct a model of empathic emotions. Based on this model, a module of emotions has been implemented as a plug-in for JSA agents. It determines the empathic emotions (their types and intensity) of such agents in real time. It has been used to develop a demonstrator where users can interact with an empathic dialog agent to obtain information on their emails. An evaluation of this agent has enabled us to both validate the proposed model of empathic emotions and highlight the positive user's perception of the virtual agent.