Weakness in the legs occurs as a result of a decrease or loss of strength in any of the muscles or muscle groups involved in the movement of the legs. The most common causes of leg weakness are due to spinal cord/nerve compression or injury in the region of the lower back and include traumatic spinal cord injuries, scoliosis, intervertebral disc prolapse, nerve impingement, tumours, infections, and so on. Skeletal muscle movement is controlled by nerves originating from the brain but these nerves are not continuous all the way to the muscles.
There is, normally, a relay in the spinal cord, where the nerves from the brain communicate with the nerves that actually reach the muscles. For the leg muscles, this nerve relay occurs in the lower section of the spinal cord in the lower back, so problems affecting the spinal cord and nerves in the region of the lower back can cause weakness in the leg muscles. These nerves, however, do not only control movement but also carry fibres that control sensation, urination, defecation and erection (in males), so it is not unusual for leg weakness to be associated with problems with these other functions.
Other causes of muscle weakness include stroke, meningitis, polio, diabetic neuropathy, multiple sclerosis, polymyositis, dermatomyositis, amyotrophic lateral sclerosis, electrolyte imbalance, metabolic disorders, nutritional deficiencies, autoimmune disorders, malignancies, toxins (e.g. Botulism), poisoning (e.g. organophosphates), connective tissue disorders, myasthenia gravis, thyrotoxicosis, drugs and so on (the list is endless really). Most of these other possible causes, however, will cause a more generalized muscle weakness, rather than weakness restricted to the legs alone. Stroke, however, tends to cause muscle weakness on one half of the body, rather than affecting both legs, for instance it could cause weakness on the right arm and leg with weakness on the left side of the face or weakness on the left arm and leg with weakness on the right side of the face.
Treatment of leg weakness, obviously, depends on the cause, but may include medications, surgery, physiotherapy and other specific and supportive therapies. However, please note that nerves, unlike most tissues in the body, have a very low capacity to heal. So if the leg weakness is due to nerve damage and depending on the extent of the damage, the individual may not be able to regain full strength in the legs. I’m not, in any way, implying that the individual doesn’t need treatment by this please, quite the contrary. The aim of treatment may be to halt or slow down the progress of whatever is causing the problem, and also to prevent complications that may arise from inactivity and disuse of the legs. On a more optimistic note, however, in some cases where the weakness is caused by spinal cord or nerve compression, surgery aimed at relieving the compression coupled with physiotherapy may restore full strength; but note that surgery has its own risks as well, including the possibility of causing complete paralysis.