ECT is sometimes used as a last resort to treat other conditions. When a person with obsessive-compulsive disorder does not respond to medications or other treatments, ECT may be used.