Net income (loss). Our net income was $1.6 million for the three months ended September 29, 2023, as compared to a net income of $0.1 million for the three months ended September 30, 2022. The increase in net income was primarily attributable to the increase in revenue and gross profit, partially offset by higher interest expense and income tax expense.
Nine Months Ended September 29, 2023 Compared to Nine Months Ended September 30, 2022
Contract revenue. Consolidated contract revenue increased $38.5 million, or 12.2%, in the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022, due to incremental revenues in both our Energy segment and in our Engineering and Consulting segment.
Contract revenue in our Energy segment increased $30.1 million, or 11.5%, in the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022, primarily as a result of increases in software licensing revenue and higher demand across the full spectrum of our energy services. Contract revenue in our Engineering and Consulting segment increased $8.4 million, or 15.6%, in the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022, primarily due to increased demand for services provided to our clients.
Direct costs of contract revenue. Direct costs of consolidated contract revenue increased $13.7 million, or 6.3%, for the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022, primarily as a result of the increase, and change of mix, in contract revenues as described above. As a percentage of contract revenue, direct salaries and wages decreased to 17.9% in the nine months ended September 29, 2023, from 19.5% in the nine months ended September 30, 2022, while subcontractor services and other direct costs decreased to 46.7% in the nine months ended September 29, 2023 from 48.7% in the nine months ended September 30, 2022.
Direct costs of contract revenue in our Energy segment increased $9.6 million, or 5.1% for the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022. Direct costs of contract revenue for the Engineering and Consulting segment increased $4.1 million, or 15.8%, in the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022.
Subcontractor services and other direct costs increased by $11.6 million, or 7.5%, and salaries and wages increased by $2.1 million, or 3.3%, in the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022, primarily as a result of the increases in contract revenue.
Gross Profit. Gross profit increased 24.8% to $125.3 million, or 35.4% gross margin, for the nine months ended September 29, 2023, compared to gross profit of $100.5 million, or 31.8% gross margin, for the nine months ended September 30, 2022. The increase in our gross margin was primarily driven by higher software licensing revenue and changes in the mix of revenues as described above combined with the absence of project startup costs for new utility programs that were incurred during the same period of fiscal year 2022 but did not recur in the same period for fiscal year 2023.
General and administrative expenses. G&A expenses increased $2.9 million, or 2.6%, in the nine months ended September 29, 2023, compared to the nine months ended September 30, 2022. G&A expenses consisted of an increase of $1.6 million in the Energy segment combined with an increase of $3.8 million in the Engineering and Consulting segment, partially offset by a decrease of $2.5 million in unallocated corporate expenses.
Within G&A expenses, the increase of $8.4 million in salaries and wages, payroll taxes and employee benefits was partially offset by a decrease of $2.6 million in stock-based compensation, a decrease of $2.5 million in other general and administrative expenses, and a decrease of $0.7 million in depreciation and amortization. The increase in salaries and wages, payroll taxes and employee benefits was primarily due to an increase in incentive compensation, consistent with the improvement in operating profit. The decrease in stock-based compensation expenses was primarily related to previously awarded stock grants reaching the end of their corresponding vesting periods, partially offset by new equity awards being issued at lower stock prices. The decrease in other general and administrative expenses was primarily due to contingent consideration expense related to prior acquisitions that occurred during the nine months