Summary:

Melee combat occurs when a melee unit (any military unit which doesn't have the Ranged Combat ability) attacks an enemy unit or city. It doesn't matter if the defender has Ranged Combat; as long as the attacker doesn't have Ranged Combat the resulting battle will be melee.