Although the original function of the dictator was to lead the Roman army in time of war, a dictator was sometimes nominated for the purpose of holding elections, restoring order, or performing vital religious functions, when it was impossible for the consuls or other magistrates to do so.