Defense Secretary Chuck Hagel ordered the military on Wednesday to improve access to treatment, quality of care and patient safety at its hospitals and clinics, giving underperforming hospitals four to six weeks to show how they will address shortcomings.

At a Pentagon news conference, Mr. Hagel said that the military’s 54 hospitals and hundreds of clinics in the United States and abroad deliver care that is comparable to that of an average civilian system.

“But we cannot accept average,” he said. In three pages of directives to the heads of the armed services, he ordered efforts to improve a system that outside experts described as awash in mediocrity, with pockets of excellence and trouble spots. By the end of the year, he said, the department will have a concrete plan for “the top performing system we all want and expect it to be.”

Mr. Hagel’s directives hew to the findings of a 645-page report that a panel of military and civilian experts produced after the secretary ordered a comprehensive review of a system that serves 1.35 million active-duty service members, as well as millions of family members and others. The study, released Wednesday, was motivated by a scandal over access to treatment in a separate hospital system managed by the Department of Veterans Affairs, and by months of inquiries by The New York Times into the quality and safety of military medical care.