Mining firm HJ Banks and Company wants to extract up to three million tonnes of coal from 325 hectares of farmland near the village of Widdrington, near the Northumberland coast.
The proposals were backed unanimously by Northumberland County Council's planning committee in July 2016. But then Javid called in the planning application for his own determination.
Following a public inquiry, a planning inspector recommended that consent for the plans be granted. But in March, Javid rejected the inspector's recommendation and refused planning permission (DCS Number 200-007-444).
In his decision, Javid accepted that the benefits of coal extraction and local employment deserved "great weight".
But, against that, he decided that the project would have "a considerable adverse impact on the landscape character" of the area. He also concluded that "overall, the scheme would have an adverse effect on greenhouse gas emissions and climate change of very considerable significance".
HJ Banks challenged the decision in the High Court. The firm argued that, if the mine could not open, imported coal would be burnt instead, probably increasing greenhouse gas emissions overall.
Mr Justice Ouseley said the "principal issue" was the effect that the mine would have on greenhouse gas emissions from the power generation industry. He noted that Javid had accepted that there "was a need" for the coal to meet Britain's energy needs and no one had suggested that his intention was to "leave the country's energy needs unmet".
What Javid failed to explain, in the judge's view, was "how a proposal needed for the country's energy could be refused" unless there was firm evidence that the energy gap would be filled by renewable or low-carbon sources.
He concluded that Javid "failed to provide adequate reasoning" for his refusal to follow the inspector's recommendations. It was, he added, possible that the secretary of state "misread and misunderstood" crucial passages of the inspector's conclusions.
The claimants also argued that Javid's ruling flew in the face of previous planning decisions and amounted to an "unheralded" policy shift.
But the judge said Javid had been entitled to take a "different approach" to the impact of indigenous coal mining on greenhouse gas emissions. The reasons for the change in approach were "explained clearly enough" in his decision letter, he ruled.
Despite this finding, the judge quashed the decision letter. The planning application will now have to be considered afresh by current housing and communities secretary James Brokenshire.