p-adic Lie groups vs. algebraic groups over $\mathbb{Q}_p$

I was asked by the person who asked the question to provide an answer. Here it goes.

You should keep in mind the example of $\text{PGL}_n(\mathbb{Z}_p)$ which is both compact and semisimple (in the sense that its Lie-algebra is semisimple) but it is not isomorphic (as a p-adic Lie group) to an algebraic group (hereafter, the $\mathbb{Q}_p$ points of a $\mathbb{Q}_p$-algebraic group).

However, $\text{PGL}_n(\mathbb{Z}_p)$ is isomorphic to an open subgroup of $\text{PGL}_n(\mathbb{Q}_p)$ which is an algebraic group, and there is a general phenomenon here.

Claim: Let $G$ be a semisimple p-adic group with trivial center. Then there exists an algebraic group $H$ such that $G$ is isomorphic to an open subgroup of $H$. Moreover, this open subgroup is either compact or of a finite index in $H$.

Proof: Define $H$ to be the group of automorphisms of the Lie-algebra of $G$. Then $H$ is algebraic and the adjoint map $G\to H$ is injective by the triviality of the center. By semisimplicity, every derivation is inner, hence $G\to H$ induces an isomorphism on the level of Lie algebra. We conclude that the image of $G$ is a submanifold of the same dimension of $H$, hence it is open. An open subgroup is closed, of course, and it follows that $G$ is isomorphic to its image (this is a general fact about Polish groups). The fact that an open subgroup of $H$ must be either open or of finite index could be deduced from Howe-Moore Theorem (considering $\ell^2(H/G)$).