An idol is like the slave who is a burden upon his master: wherever he sends him, he brings no good.
The point is that Allah’s words, “upholding justice,” are like His words, “Indeed, my Lord is on a straight path.”
The phrase “upholding justice” is in the accusative, functioning as a circumstantial qualifier. There are two ways to analyse it.
The first is that it qualifies the subject in “Allah bears witness,” and is governed by the verbal meaning. On this reading, the meaning is: Allah bears witness, while upholding justice, that there is no god but Him.
The second is that it qualifies “He,” and is governed by the meaning of negation: there is no god but Him, while He upholds justice.
There is a clear difference between these two analyses. The first means that Allah bears witness that there is no god but Him while speaking justly, commanding justice, acting with justice, and requiting accordingly.
For justice applies to both speech and action, and one who upholds justice is just in both his words and his deeds.
Thus Allah bears witness, upholding justice in word and deed, that there is no god but Him. This establishes that this testimony is just and equitable. It is the most just testimony, just as the truth to which it bears witness is the most just, soundest, and truest of all things.
Ibn al-Sā’ib and others mention an account concerning the occasion of this verse’s revelation that supports this:
“Two Jewish scholars from Syria came to the Prophet, peace and blessings be upon him. When they saw Medina, one said to the other, ‘How closely this city resembles the city of the prophet who will appear at the end of time!’ When they entered the Prophet’s presence, peace and blessings be upon him, they asked him, ‘Are you Muhammad?’ He replied, ‘Yes.’ They asked, ‘And Ahmad?’ He replied, ‘Yes.’ They said, ‘We will ask you about a testimony. If you tell us what it is, we will believe in you.’ He said, ‘Ask me.’ They said, ‘Tell us about the greatest testimony in the Book of Allah.’ Then the following was revealed: ‘Allah bears witness that there is no god but Him,’ to the end of the verse.”